UNPKG

@serenity-js/core

Version:

The core Serenity/JS framework, providing the Screenplay Pattern interfaces, as well as the test reporting and integration infrastructure

31 lines (27 loc) 940 B
import type { JSONObject } from 'tiny-types'; import { ensure, isDefined } from 'tiny-types'; import type { SerialisedOutcome} from '../model'; import { Outcome, TestSuiteDetails } from '../model'; import { Timestamp } from '../screenplay'; import { DomainEvent } from './DomainEvent'; /** * @group Events */ export class TestSuiteFinished extends DomainEvent { static fromJSON(o: JSONObject): TestSuiteFinished { return new TestSuiteFinished( TestSuiteDetails.fromJSON(o.details as JSONObject), Outcome.fromJSON(o.outcome as SerialisedOutcome), Timestamp.fromJSON(o.timestamp as string), ); } constructor( public readonly details: TestSuiteDetails, public readonly outcome: Outcome, timestamp?: Timestamp, ) { super(timestamp); ensure('details', details, isDefined()); ensure('outcome', outcome, isDefined()); } }