UNPKG

ivr-tester

Version:

An automated testing framework for IVR call flows

41 lines (40 loc) 1.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PluginManager = void 0; const Emitter_1 = require("../Emitter"); class PluginManager extends Emitter_1.TypedEmitter { constructor(plugins) { super(); this.plugins = plugins; } initialise(testRunner) { this.testRunner = testRunner; for (const plugin of this.plugins) { plugin.initialise(this, testRunner); } } abortTests(reason) { this.emit("testsAborting", { reason }); this.testRunner.stop(true); } serverListening(callServer) { this.emit("callServerStarted", { callServer }); callServer.on("testStarted", (event) => { for (const plugin of this.plugins) { if (typeof plugin.testStarted === "function") { plugin.testStarted(event.testSession); } } }); } callRequested(requestedCall, total) { this.emit("callRequested", { requestedCall, total, }); } callRequestErrored(error) { this.emit("callRequestErrored", { error }); } } exports.PluginManager = PluginManager;