import assert from 'assert'; import sinon from 'sinon'; import { Response } from '../lib/utils/plivoxml'; describe('PlivoXML', function () { it('should work', function (done) { const response = new Response(); response.addPreAnswer(); response.addRecord(); response.addHangup(); response.addSpeak('text'); response.addWait(); response.addDTMF('123'); response.addConference('test'); response.addRedirect('url'); response.addGetDigits(); response.addPlay('url'); const dial = response.addDial(); dial.addNumber('123'); dial.addUser('sip:test@sip.plivo.com'); response.addMessage('∫test', { src: '123', dst: '456', }); assert.equal('text123testurlurl123sip:test@sip.plivo.com∫test', response.toXML()); done(); }); it('tests MultiPartyCall', function (done){ const mpcResponse = new Response(); mpcResponse.addMultiPartyCall('Nairobi',{ role: 'Agent', maxDuration: 1000, statusCallbackEvents: 'participant-speak-events, participant-digit-input-events, add-participant-api-events, participant-state-changes, mpc-state-changes' }); assert.equal('Nairobi',mpcResponse.toXML()); done(); }); });