ivr-tester
Version:
An automated testing framework for IVR call flows
41 lines (40 loc) • 1.44 kB
TypeScript
import { IvrTesterPlugin } from "./IvrTesterPlugin";
import { CallServer, CallServerEvents } from "../testing/TwilioCallServer";
import { Emitter, TypedEmitter } from "../Emitter";
import { RequestedCall } from "../call/Caller";
import { TestRunner } from "../testRunner";
export interface CallRequestedEvent {
requestedCall: RequestedCall;
total: number;
}
export interface CallRequestErroredEvent {
error: Error;
}
export interface CallServerStartedEvent {
callServer: Emitter<CallServerEvents>;
}
export interface TestsAbortingEvent {
reason: string;
}
export declare type PluginEvents = {
callServerStarted: CallServerStartedEvent;
callRequested: CallRequestedEvent;
callRequestErrored: CallRequestErroredEvent;
testsAborting: TestsAbortingEvent;
};
/**
* Interface exposed to plugins to allow them to listen to events and abort testing.
*/
export interface PluginHost extends Omit<Emitter<PluginEvents>, "emit"> {
abortTests(reason: string): void;
}
export declare class PluginManager extends TypedEmitter<PluginEvents> implements PluginHost {
private readonly plugins;
private testRunner;
constructor(plugins: IvrTesterPlugin[]);
initialise(testRunner: TestRunner): void;
abortTests(reason: string): void;
serverListening(callServer: CallServer): void;
callRequested(requestedCall: RequestedCall, total: number): void;
callRequestErrored(error: Error): void;
}