diff --git a/integration_test/playertesting/PlayerWorld.ts b/integration_test/playertesting/PlayerWorld.ts index 8f412b8c..e6eeb08b 100644 --- a/integration_test/playertesting/PlayerWorld.ts +++ b/integration_test/playertesting/PlayerWorld.ts @@ -10,12 +10,12 @@ import { Event } from 'bitmovin-player-react-native'; import { EventType } from './EventType'; import { SingleEventExpectation, - P, - F, + PlainEvent, + FilteredEvent, } from './expectations/SingleEventExpectation'; import { MultipleEventsExpectation, - S, + EventSequence, } from './expectations/MultipleEventsExpectation'; export default class PlayerWorld { @@ -151,7 +151,7 @@ export default class PlayerWorld { (player) => { player.play(); }, - new F( + FilteredEvent( EventType.TimeChanged, (event) => event.currentTime >= time ), @@ -187,7 +187,7 @@ export default class PlayerWorld { if (expectationConvertible instanceof SingleEventExpectation) { actualExpectation = expectationConvertible; } else { - actualExpectation = new P(expectationConvertible as EventType); + actualExpectation = PlainEvent(expectationConvertible as EventType); } let resolve: (event: T) => void = () => {}; let reject: (error: Error) => void = () => {}; @@ -223,9 +223,9 @@ export default class PlayerWorld { if (expectationsConvertible instanceof MultipleEventsExpectation) { actualExpectation = expectationsConvertible; } else { - actualExpectation = new S( - Array.from(expectationsConvertible as EventType[]).map( - (eventType) => new P(eventType) + actualExpectation = EventSequence( + Array.from(expectationsConvertible as EventType[]).map((eventType) => + PlainEvent(eventType) ) ); } diff --git a/integration_test/playertesting/expectations/MultipleEventsExpectation.ts b/integration_test/playertesting/expectations/MultipleEventsExpectation.ts index 49b66634..e18d3bb7 100644 --- a/integration_test/playertesting/expectations/MultipleEventsExpectation.ts +++ b/integration_test/playertesting/expectations/MultipleEventsExpectation.ts @@ -149,7 +149,27 @@ export class AnyEventExpectation extends MultipleEventsExpectation { } } -export class S extends EventSequenceExpectation {} -export class B extends EventBagExpectation {} -export class R extends RepeatedEventExpectation {} -export class A extends AnyEventExpectation {} +export function EventSequence( + singleExpectationConvertibles: SingleEventExpectation[] | EventType[] +): EventSequenceExpectation { + return new EventSequenceExpectation(singleExpectationConvertibles); +} + +export function EventBag( + singleExpectationConvertibles: SingleEventExpectation[] | EventType[] +): EventBagExpectation { + return new EventBagExpectation(singleExpectationConvertibles); +} + +export function RepeatedEvent( + singleExpectationConvertible: SingleEventExpectation | EventType, + count: number +): EventSequenceExpectation { + return new RepeatedEventExpectation(singleExpectationConvertible, count); +} + +export function AnyEvent( + singleExpectationConvertibles: SingleEventExpectation[] | EventType[] +): AnyEventExpectation { + return new AnyEventExpectation(singleExpectationConvertibles); +} diff --git a/integration_test/playertesting/expectations/SingleEventExpectation.ts b/integration_test/playertesting/expectations/SingleEventExpectation.ts index b9e5427a..0943786a 100644 --- a/integration_test/playertesting/expectations/SingleEventExpectation.ts +++ b/integration_test/playertesting/expectations/SingleEventExpectation.ts @@ -66,5 +66,13 @@ export class FilteredEventExpectation< } } -export class P extends PlainEventExpectation {} -export class F extends FilteredEventExpectation {} +export function PlainEvent(eventType: EventType): PlainEventExpectation { + return new PlainEventExpectation(eventType); +} + +export function FilteredEvent( + eventType: EventType, + filter: (event: E) => boolean +): FilteredEventExpectation { + return new FilteredEventExpectation(eventType, filter); +}