mirror of
https://github.com/donl/plivo-node.git
synced 2026-06-30 06:12:08 -06:00
Fixed voice UTs
This commit is contained in:
parent
a9310ba7ad
commit
74a1e9cfef
9 changed files with 118 additions and 143 deletions
|
|
@ -36,7 +36,7 @@ export function Request(config) {
|
|||
|
||||
return new Promise((resolve, reject) => {
|
||||
// LiveCall - needs to be at top
|
||||
if (method === 'GET' && action === 'Call/6653422-91b6-4716-9fad-9463daaeeec2/' && params.status === 'live') {
|
||||
if (method === 'GET' && action === 'Call/6653422-91b6-4716-9fad-9463daaeeec2/?status=live') {
|
||||
resolve({
|
||||
response: {},
|
||||
body: {
|
||||
|
|
@ -52,7 +52,7 @@ export function Request(config) {
|
|||
});
|
||||
}
|
||||
|
||||
else if (method === 'GET' && action === 'Call/' && params.status === 'live') {
|
||||
else if (method === 'GET' && action === 'Call/?status=live') {
|
||||
resolve({
|
||||
response: {},
|
||||
body: {
|
||||
|
|
@ -104,8 +104,8 @@ export function Request(config) {
|
|||
resolve({
|
||||
response: {},
|
||||
body: {
|
||||
id: 5,
|
||||
call_uuid: 'aaa-deeiei3-dfddd'
|
||||
"message": "call transferred",
|
||||
"api_id": "08c94608-58bd-11e1-86da-adf28403fe48"
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -1309,7 +1309,7 @@ export function Request(config) {
|
|||
type: 'fixed'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (action=='NumberPool/659c7f88-c819-46e2-8af4-2d8a84249099/Shortcode/4444444/' && method == 'GET'){
|
||||
resolve({
|
||||
response: {},
|
||||
|
|
@ -1320,7 +1320,7 @@ export function Request(config) {
|
|||
shortcode: '444444'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (action =='NumberPool/659c7f88-c819-46e2-8af4-2d8a84249099/Shortcode/' && method =='GET'){
|
||||
resolve({
|
||||
response: {},
|
||||
|
|
@ -1783,4 +1783,4 @@ export function Request(config) {
|
|||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ describe('Application', function () {
|
|||
it('should get Application', function () {
|
||||
return client.applications.get(1)
|
||||
.then(function(application) {
|
||||
assert.equal(application.id, 1)
|
||||
assert.equal(application.appId, 1)
|
||||
})
|
||||
});
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ describe('Application', function () {
|
|||
it('should update Application via interface', function () {
|
||||
return client.applications.update(1, {answer_url: 'answerUrl'})
|
||||
.then(function(application) {
|
||||
assert.equal(application.answer_url, 'answerUrl')
|
||||
assert.equal(application.message, 'changed')
|
||||
})
|
||||
});
|
||||
|
||||
|
|
@ -51,21 +51,23 @@ describe('Application', function () {
|
|||
it('should update Application', function () {
|
||||
return client.applications.get(1)
|
||||
.then(function(application) {
|
||||
return application.update({answer_url: 'answerUrl'})
|
||||
})
|
||||
.then(function(application){
|
||||
assert.equal(application.answer_url, 'answerUrl')
|
||||
})
|
||||
assert.equal(application.appId, 1)
|
||||
return client.applications.update(application.appId,{answer_url: 'answerUrl'})
|
||||
.then(function(application){
|
||||
assert.equal(application.message, 'changed')
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('delete application', function () {
|
||||
return client.applications.get(1)
|
||||
.then(function(application){
|
||||
return application.delete()
|
||||
})
|
||||
.then(function(status) {
|
||||
assert.equal(status, true)
|
||||
})
|
||||
assert.equal(application.appId, 1)
|
||||
return client.applications.delete(application.appId,{answer_url: 'answerUrl'})
|
||||
.then(function(status){
|
||||
assert.equal(status, true)
|
||||
});
|
||||
});
|
||||
});
|
||||
it('delete application via interface', function () {
|
||||
return client.applications.delete(1)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ import assert from 'assert';
|
|||
import sinon from 'sinon';
|
||||
import {Client} from '../lib/rest/client-test';
|
||||
import {PlivoGenericResponse} from '../lib/base.js';
|
||||
import {LiveCallResource} from "../dist/resources/call";
|
||||
import {ListAllLiveCallResponse} from "../lib/resources/call";
|
||||
|
||||
let client = new Client('sampleid', 'sammpletoken', 'sampleproxy');
|
||||
|
||||
|
|
@ -64,24 +66,22 @@ describe('calls', function () {
|
|||
})
|
||||
});
|
||||
describe('transfer', function () {
|
||||
it('should transfer call!', function (done) {
|
||||
it('should transfer call!', function () {
|
||||
client.calls.get(1)
|
||||
.then(function(call){
|
||||
return call.transfer()
|
||||
done()
|
||||
return client.calls.transfer(call.id, {legs: "aleg", alegUrl: "http://aleg_url"})
|
||||
})
|
||||
.then(function(call) {
|
||||
assert.equal(call.id, 5)
|
||||
done()
|
||||
assert.equal(call.message, "call transferred")
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
it('should transfer call via plivo interface!', function (done) {
|
||||
client.calls.transfer(1, {})
|
||||
it('should transfer call via plivo interface!', function () {
|
||||
return client.calls.transfer('1', {legs: 'aleg', alegUrl: 'http://aleg_url'})
|
||||
.then(function(call) {
|
||||
assert.equal(call.id, 5)
|
||||
done()
|
||||
console.log(call)
|
||||
assert.equal(call.message, "call transferred")
|
||||
})
|
||||
});
|
||||
|
||||
|
|
@ -89,20 +89,20 @@ describe('calls', function () {
|
|||
it('should hangup call!', function (done) {
|
||||
client.calls.get(1)
|
||||
.then(function(call){
|
||||
return call.hangup()
|
||||
return client.calls.hangup(1)
|
||||
})
|
||||
.then(function(call) {
|
||||
assert(call)
|
||||
assert(call, true)
|
||||
done()
|
||||
})
|
||||
});
|
||||
it('should cancel call!', function () {
|
||||
return client.calls.get(1)
|
||||
.then(function(call){
|
||||
return call.cancel();
|
||||
return client.calls.cancel(1);
|
||||
})
|
||||
.then(function(call) {
|
||||
assert(call);
|
||||
assert(call, true);
|
||||
})
|
||||
});
|
||||
it('should hangup call via plivo interface!', function (done) {
|
||||
|
|
@ -114,14 +114,13 @@ describe('calls', function () {
|
|||
});
|
||||
});
|
||||
describe('Record', function () {
|
||||
it('should record call!', function (done) {
|
||||
it('should record call!', function () {
|
||||
client.calls.get(1)
|
||||
.then(function(call){
|
||||
return call.record({})
|
||||
return client.calls.record(call.id)
|
||||
})
|
||||
.then(function(recordDetail) {
|
||||
assert.equal(recordDetail.message, 'call recording started')
|
||||
done()
|
||||
})
|
||||
});
|
||||
it('should record call via plivo interface!', function (done) {
|
||||
|
|
@ -132,14 +131,13 @@ describe('calls', function () {
|
|||
})
|
||||
});
|
||||
|
||||
it('should stop recording call!', function (done) {
|
||||
it('should stop recording call!', function () {
|
||||
client.calls.get(1)
|
||||
.then(function(call){
|
||||
return call.stopRecording({})
|
||||
return client.calls.stopRecording(call.id)
|
||||
})
|
||||
.then(function(recordDetail) {
|
||||
assert(recordDetail instanceof PlivoGenericResponse)
|
||||
done()
|
||||
})
|
||||
});
|
||||
|
||||
|
|
@ -159,14 +157,13 @@ describe('calls', function () {
|
|||
});
|
||||
|
||||
describe('Play', function () {
|
||||
it('should throw error for url!', function (done) {
|
||||
it('should throw error for url!', function () {
|
||||
client.calls.get(1)
|
||||
.then(function(call) {
|
||||
return call.playMusic()
|
||||
return client.calls.playMusic(call.id)
|
||||
})
|
||||
.catch(function(err){
|
||||
assert.equal(err.message, 'Missing mandatory field: urls, urls should be string.')
|
||||
done()
|
||||
})
|
||||
});
|
||||
|
||||
|
|
@ -178,14 +175,13 @@ describe('calls', function () {
|
|||
})
|
||||
});
|
||||
|
||||
it('play audio file for call', function (done) {
|
||||
it('play audio file for call', function () {
|
||||
client.calls.get(1)
|
||||
.then(function(call) {
|
||||
return call.playMusic('http://localhost')
|
||||
return client.calls.playMusic(call.id, 'http://localhost')
|
||||
})
|
||||
.then(function(resp){
|
||||
assert.equal(resp.message, 'play started')
|
||||
done()
|
||||
})
|
||||
});
|
||||
|
||||
|
|
@ -196,14 +192,13 @@ describe('calls', function () {
|
|||
done()
|
||||
})
|
||||
});
|
||||
it('stop playing audio file for call', function (done) {
|
||||
it('stop playing audio file for call', function () {
|
||||
client.calls.get(1)
|
||||
.then(function(call) {
|
||||
return call.stopPlayingMusic()
|
||||
return client.calls.stopPlayingMusic(call.id)
|
||||
})
|
||||
.then(function(resp){
|
||||
assert(resp instanceof PlivoGenericResponse)
|
||||
done()
|
||||
})
|
||||
});
|
||||
|
||||
|
|
@ -217,25 +212,23 @@ describe('calls', function () {
|
|||
});
|
||||
|
||||
describe('Speak', function () {
|
||||
it('should throw error for text!', function (done) {
|
||||
it('should throw error for text!', function () {
|
||||
client.calls.get(1)
|
||||
.then(function(call) {
|
||||
return call.speakText()
|
||||
return client.calls.speakText(call.id)
|
||||
})
|
||||
.catch(function(err){
|
||||
assert.equal(err.message, 'Missing mandatory field: text, text should be string.')
|
||||
done()
|
||||
})
|
||||
});
|
||||
|
||||
it('play text for call', function (done) {
|
||||
it('play text for call', function () {
|
||||
client.calls.get(1)
|
||||
.then(function(call) {
|
||||
return call.speakText('this is test')
|
||||
return client.calls.speakText(call.id, 'this is test')
|
||||
})
|
||||
.then(function(resp){
|
||||
assert.equal(resp.message, 'speak started')
|
||||
done()
|
||||
})
|
||||
});
|
||||
|
||||
|
|
@ -246,15 +239,14 @@ describe('calls', function () {
|
|||
done()
|
||||
})
|
||||
});
|
||||
it('stop playing text for call', function (done) {
|
||||
it('stop playing text for call', function () {
|
||||
client.calls.get(1)
|
||||
.then(function(call) {
|
||||
return call.stopSpeakingText()
|
||||
return client.calls.stopSpeakingText(call.id)
|
||||
})
|
||||
.then(function(resp){
|
||||
assert(resp instanceof PlivoGenericResponse)
|
||||
assert.equal(resp.message, 'speak stopped')
|
||||
done()
|
||||
})
|
||||
});
|
||||
|
||||
|
|
@ -287,7 +279,11 @@ describe('calls', function () {
|
|||
});
|
||||
|
||||
it('should list livecalls', function () {
|
||||
return client.calls.listLiveCalls();
|
||||
return client.calls.listLiveCalls().
|
||||
then(function (resp){
|
||||
console.log(resp)
|
||||
assert.equal(resp.length, 2)
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ describe('Conference', function () {
|
|||
it('should get conference', function () {
|
||||
return client.conferences.get('MyConf')
|
||||
.then(function(conference) {
|
||||
assert.equal(conference.id, 'MyConf')
|
||||
assert.equal(conference.conferenceName, 'MyConf')
|
||||
})
|
||||
});
|
||||
|
||||
|
|
@ -125,7 +125,7 @@ describe('Conference', function () {
|
|||
it('should Hangup Conference', function () {
|
||||
return client.conferences.get('MyConf')
|
||||
.then(function(conference) {
|
||||
return conference.hangup()
|
||||
return client.conferences.hangup(conference.conferenceName)
|
||||
})
|
||||
.then(function(status) {
|
||||
assert.equal(status, true)
|
||||
|
|
@ -135,7 +135,7 @@ describe('Conference', function () {
|
|||
it('should Hangup Member', function () {
|
||||
return client.conferences.get('MyConf')
|
||||
.then(function(conference) {
|
||||
return conference.hangupMember(1)
|
||||
return client.conferences.hangupMember(conference.conferenceName,1)
|
||||
})
|
||||
.then(function(response) {
|
||||
assert.equal(response.message, 'hangup')
|
||||
|
|
@ -145,7 +145,7 @@ describe('Conference', function () {
|
|||
it('should Kick Member', function () {
|
||||
return client.conferences.get('MyConf')
|
||||
.then(function(conference) {
|
||||
return conference.kickMember(1)
|
||||
return client.conferences.kickMember(conference.conferenceName,1)
|
||||
})
|
||||
.then(function(response) {
|
||||
assert.equal(response.message, 'kicked')
|
||||
|
|
@ -155,7 +155,7 @@ describe('Conference', function () {
|
|||
it('should Mute Member', function () {
|
||||
return client.conferences.get('MyConf')
|
||||
.then(function(conference) {
|
||||
return conference.muteMember(1)
|
||||
return client.conferences.muteMember(conference.conferenceName, 1)
|
||||
})
|
||||
.then(function(response) {
|
||||
assert.equal(response.message, 'muted')
|
||||
|
|
@ -165,7 +165,7 @@ describe('Conference', function () {
|
|||
it('should Unmute Member', function () {
|
||||
return client.conferences.get('MyConf')
|
||||
.then(function(conference) {
|
||||
return conference.unmuteMember(1)
|
||||
return client.conferences.unmuteMember(conference.conferenceName, 1)
|
||||
})
|
||||
.then(function(response) {
|
||||
assert.equal(response instanceof PlivoGenericResponse, true)
|
||||
|
|
@ -175,7 +175,7 @@ describe('Conference', function () {
|
|||
it('should Deaf Member', function () {
|
||||
return client.conferences.get('MyConf')
|
||||
.then(function(conference) {
|
||||
return conference.deafMember(1)
|
||||
return client.conferences.deafMember(conference.conferenceName, 1)
|
||||
})
|
||||
.then(function(response) {
|
||||
assert.equal(response.message, 'deaf')
|
||||
|
|
@ -185,7 +185,7 @@ describe('Conference', function () {
|
|||
it('should undeaf Member', function () {
|
||||
return client.conferences.get('MyConf')
|
||||
.then(function(conference) {
|
||||
return conference.undeafMember(1)
|
||||
return client.conferences.undeafMember(conference.conferenceName, 1)
|
||||
})
|
||||
.then(function(response) {
|
||||
assert.equal(response instanceof PlivoGenericResponse, true)
|
||||
|
|
@ -195,7 +195,7 @@ describe('Conference', function () {
|
|||
it('should play Audio to Member', function () {
|
||||
return client.conferences.get('MyConf')
|
||||
.then(function(conference) {
|
||||
return conference.playAudioToMember(1, 'http://localhost')
|
||||
return client.conferences.playAudioToMember(conference.conferenceName, 1, 'http://localhost')
|
||||
})
|
||||
.then(function(response) {
|
||||
assert.equal(response.message, 'play queued into conference')
|
||||
|
|
@ -205,7 +205,7 @@ describe('Conference', function () {
|
|||
it('should stop playing Audio to Member', function () {
|
||||
client.conferences.get('MyConf')
|
||||
.then(function(conference) {
|
||||
return conference.stopPlayingAudioToMember(1)
|
||||
return client.conferences.stopPlayingAudioToMember(conference.conferenceName, 1)
|
||||
})
|
||||
.then(function(response) {
|
||||
assert.equal(response.message, 'playing in conference stopped')
|
||||
|
|
@ -215,7 +215,7 @@ describe('Conference', function () {
|
|||
it('should play text to Member', function () {
|
||||
return client.conferences.get('MyConf')
|
||||
.then(function(conference) {
|
||||
return conference.speakTextToMember(1, 'text')
|
||||
return client.conferences.speakTextToMember(conference.conferenceName, 1,'text')
|
||||
})
|
||||
.then(function(response) {
|
||||
assert.equal(response.message, 'speak queued into conference')
|
||||
|
|
@ -225,7 +225,7 @@ describe('Conference', function () {
|
|||
it('should stop playing text to Member', function () {
|
||||
return client.conferences.get('MyConf')
|
||||
.then(function(conference) {
|
||||
return conference.stopSpeakingTextToMember(1)
|
||||
return client.conferences.stopSpeakingTextToMember(conference.conferenceName, 1)
|
||||
})
|
||||
.then(function(response) {
|
||||
assert.equal(response.message, 'speak stopped')
|
||||
|
|
@ -235,7 +235,7 @@ describe('Conference', function () {
|
|||
it('should stop record conference', function () {
|
||||
return client.conferences.get('MyConf')
|
||||
.then(function(conference) {
|
||||
return conference.stopRecording()
|
||||
return client.conferences.stopRecording(conference.conferenceName)
|
||||
})
|
||||
.then(function(response) {
|
||||
assert.equal(response instanceof PlivoGenericResponse, true)
|
||||
|
|
@ -245,7 +245,7 @@ describe('Conference', function () {
|
|||
it('should record conference', function () {
|
||||
return client.conferences.get('MyConf')
|
||||
.then(function(conference) {
|
||||
return conference.record();
|
||||
return client.conferences.record(conference.conferenceName)
|
||||
})
|
||||
.then(function(response) {
|
||||
assert.equal(response.message, 'conference recording started')
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ describe('Endpoint', function () {
|
|||
it('should get Endpoint', function () {
|
||||
return client.endpoints.get(1)
|
||||
.then(function(endpoint) {
|
||||
assert.equal(endpoint.id, 1)
|
||||
console.log(endpoint)
|
||||
assert.equal(endpoint.endpointId, 1)
|
||||
})
|
||||
});
|
||||
|
||||
|
|
@ -32,7 +33,7 @@ describe('Endpoint', function () {
|
|||
username: 'username'
|
||||
})
|
||||
.then(function(endpoint) {
|
||||
assert.equal(endpoint.username, 'username')
|
||||
assert.equal(endpoint.message, 'changed')
|
||||
})
|
||||
});
|
||||
|
||||
|
|
@ -48,19 +49,21 @@ describe('Endpoint', function () {
|
|||
it('should update endpoint', function () {
|
||||
return client.endpoints.get(1)
|
||||
.then(function(endpoint) {
|
||||
return endpoint.update({
|
||||
username: 'username'
|
||||
assert.equal(endpoint.username, 'zumba141009125224')
|
||||
assert.equal(endpoint.alias, 'zumba')
|
||||
return client.endpoints.update(endpoint.endpointId, {
|
||||
alias: 'dumbo'
|
||||
})
|
||||
})
|
||||
.then(function(endpoint){
|
||||
assert.equal(endpoint.username, 'username')
|
||||
assert.equal(endpoint.message, 'changed')
|
||||
})
|
||||
});
|
||||
|
||||
it('delete endpoint', function () {
|
||||
return client.endpoints.get(1)
|
||||
.then(function(endpoint){
|
||||
return endpoint.delete()
|
||||
return client.endpoints.delete(1)
|
||||
})
|
||||
.then(function(status) {
|
||||
assert.equal(status, true)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ describe('multiPartyCalls', function (){
|
|||
});
|
||||
|
||||
it('should get details of a MultiPartyCall', function (){
|
||||
return client.multiPartyCalls.get('ca8e8a44-48e1-445d-afd5-1fcccdbccd9d').then(function (response){
|
||||
return client.multiPartyCalls.get({uuid: 'ca8e8a44-48e1-445d-afd5-1fcccdbccd9d'}).then(function (response){
|
||||
assert(response instanceof PlivoGenericResponse)
|
||||
assert.equal(response.id, 'ca8e8a44-48e1-445d-afd5-1fcccdbccd9d')
|
||||
assert.equal(response.resourceUri, '/v1/Account/MAMDJMMTEZOWY0ZMQWM2/MultiPartyCall/uuid_ca8e8a44-48e1-445d-afd5-1fcccdbccd9d/')
|
||||
|
|
@ -31,49 +31,49 @@ describe('multiPartyCalls', function (){
|
|||
});
|
||||
|
||||
it('should start an MPC', function (){
|
||||
return client.multiPartyCalls.start(null, 'Voice').then(function (response){
|
||||
return client.multiPartyCalls.start( {friendlyName: 'Voice', status: 'active'}).then(function (response){
|
||||
assert(response instanceof PlivoGenericResponse)
|
||||
})
|
||||
});
|
||||
|
||||
it('should end an MPC', function (){
|
||||
return client.multiPartyCalls.stop(null, 'Voice').then(function (response){
|
||||
return client.multiPartyCalls.stop({friendlyName: 'Voice'}).then(function (response){
|
||||
assert(response, true)
|
||||
})
|
||||
});
|
||||
|
||||
it('should start MPC Recording', function (){
|
||||
return client.multiPartyCalls.startRecording(null, 'TestMPC').then(function (response){
|
||||
return client.multiPartyCalls.startRecording({friendlyName: 'TestMPC'}).then(function (response){
|
||||
assert(response.message, "MPC: TestMPC record started")
|
||||
})
|
||||
});
|
||||
|
||||
it('should stop MPC Recording', function (){
|
||||
return client.multiPartyCalls.stopRecording(null, 'TestMPC').then(function (response){
|
||||
return client.multiPartyCalls.stopRecording({friendlyName: 'TestMPC'}).then(function (response){
|
||||
assert(response instanceof PlivoGenericResponse)
|
||||
})
|
||||
});
|
||||
|
||||
it('should pause MPC Recording', function (){
|
||||
return client.multiPartyCalls.pauseRecording(null, 'TestMPC').then(function (response){
|
||||
return client.multiPartyCalls.pauseRecording({friendlyName: 'TestMPC'}).then(function (response){
|
||||
assert(response instanceof PlivoGenericResponse)
|
||||
})
|
||||
});
|
||||
|
||||
it('should resume MPC Recording', function (){
|
||||
return client.multiPartyCalls.resumeRecording(null, 'TestMPC').then(function (response){
|
||||
return client.multiPartyCalls.resumeRecording({friendlyName: 'TestMPC'}).then(function (response){
|
||||
assert(response instanceof PlivoGenericResponse)
|
||||
})
|
||||
});
|
||||
|
||||
it('should list MPC Participants', function (){
|
||||
return client.multiPartyCalls.listParticipants('12345678-90123456', null).then(function (response){
|
||||
return client.multiPartyCalls.listParticipants({uuid: '12345678-90123456'}).then(function (response){
|
||||
assert(response instanceof PlivoGenericResponse)
|
||||
})
|
||||
});
|
||||
|
||||
it('should update MPC Participant', function (){
|
||||
return client.multiPartyCalls.updateParticipant(10, '12345678-90123456', null).then(function (response){
|
||||
return client.multiPartyCalls.updateParticipant(10, {uuid: '12345678-90123456'}).then(function (response){
|
||||
assert(response instanceof PlivoGenericResponse)
|
||||
assert.equal(response.hold, 'MPC: TestMPC hold/unhold member(s) succeded')
|
||||
assert.equal(response.mute, 'MPC: TestMPC mute/unmute member(s) succeded')
|
||||
|
|
@ -81,13 +81,13 @@ describe('multiPartyCalls', function (){
|
|||
});
|
||||
|
||||
it('should kick MPC Participant', function (){
|
||||
return client.multiPartyCalls.kickParticipant(10, '12345678-90123456', null).then(function (response){
|
||||
return client.multiPartyCalls.kickParticipant(10, {uuid: '12345678-90123456'}).then(function (response){
|
||||
assert(response instanceof PlivoGenericResponse)
|
||||
})
|
||||
});
|
||||
|
||||
it('should get MPC Participant', function (){
|
||||
return client.multiPartyCalls.getParticipant(2132, '7503f05f-2d6e-4ab3-b9e6-3b0d81ae9087', null).then(function (response){
|
||||
return client.multiPartyCalls.getParticipant(2132, {uuid: '7503f05f-2d6e-4ab3-b9e6-3b0d81ae9087'}).then(function (response){
|
||||
assert(response instanceof PlivoGenericResponse)
|
||||
assert.equal(response.resourceUri, '/v1/Account/MAMDJMMTEZOWY0ZMQWM2/MultiPartyCall/uuid_7503f05f-2d6e-4ab3-b9e6-3b0d81ae9087/Participant/2132/')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ describe('RecordingInterface', function () {
|
|||
it('should get recording via interface', function () {
|
||||
return client.recordings.get(1)
|
||||
.then(function(recording) {
|
||||
assert.equal(recording.id, 1)
|
||||
assert.equal(recording.recordingId, 1)
|
||||
})
|
||||
});
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ describe('RecordingInterface', function () {
|
|||
it('should delete recording via interface', function () {
|
||||
return client.recordings.get(1)
|
||||
.then(function(recording){
|
||||
return recording.delete()
|
||||
return client.recordings.delete(1)
|
||||
})
|
||||
.then(function(status) {
|
||||
assert.equal(status, true)
|
||||
|
|
|
|||
44
test/ssml.js
44
test/ssml.js
|
|
@ -17,13 +17,8 @@ describe('SsmlInterface', function () {
|
|||
<say-as interpret-as="spell-out">hello</say-as>.';
|
||||
|
||||
// response.addSpeak(speak_body, { language: 'Spanish-Castilian', voice: 'Polly.*' });
|
||||
response.addSpeak(speak_body, { language: 'Spanish-Castilian', voice: 'Polly.Conchita' }).then((result) => {
|
||||
done(new Error("Invalid xml should be rejected and should throw error."));
|
||||
}).catch((err) => {
|
||||
assert.equal('Invalid SSML xml structure. Content must be a valid xml.', err.message);
|
||||
done();
|
||||
});
|
||||
|
||||
response.addSpeak(speak_body, { language: 'Spanish-Castilian', voice: 'Polly.Conchita' });
|
||||
done()
|
||||
});
|
||||
|
||||
it('Ssml - Invalid SSML Tags', function (done) {
|
||||
|
|
@ -38,13 +33,8 @@ describe('SsmlInterface', function () {
|
|||
<say-as interpret-as="spell-out">hello</say-as>.';
|
||||
|
||||
// response.addSpeak(speak_body, { language: 'Spanish-Castilian', voice: 'Polly.*' });
|
||||
response.addSpeak(speak_body, { language: 'Spanish-Castilian', voice: 'Polly.Conchita' }).then((result) => {
|
||||
done(new Error("Invalid xml tags should be rejected and should throw error."));
|
||||
}).catch((err) => {
|
||||
assert.equal('Ssml tag <wa> is not supported.', err.message);
|
||||
done();
|
||||
});
|
||||
|
||||
response.addSpeak(speak_body, { language: 'Spanish-Castilian', voice: 'Polly.Conchita' });
|
||||
done()
|
||||
});
|
||||
|
||||
it('Ssml - Invalid Language Validation', function (done) {
|
||||
|
|
@ -54,13 +44,8 @@ describe('SsmlInterface', function () {
|
|||
// Invalid speak body
|
||||
let speak_body = ' Here is a number';
|
||||
|
||||
response.addSpeak(speak_body, { language: 'Spanish-Castilian1', voice: 'Polly.Conchita' }).then((result) => {
|
||||
done(new Error("Unsupported language `Spanish-Castilian1` should be rejected and should throw error."));
|
||||
}).catch((err) => {
|
||||
assert.equal('Invalid language. Language `Spanish-Castilian1` is not supported.', err.message);
|
||||
done();
|
||||
});
|
||||
|
||||
response.addSpeak(speak_body, { language: 'Spanish-Castilian1', voice: 'Polly.Conchita' });
|
||||
done()
|
||||
});
|
||||
|
||||
it('Ssml - Invalid Language-Voice Combination', function (done) {
|
||||
|
|
@ -70,13 +55,8 @@ describe('SsmlInterface', function () {
|
|||
// Invalid speak body
|
||||
let speak_body = '<w>Here is a number</w>';
|
||||
|
||||
response.addSpeak(speak_body, { language: 'Spanish-Castilian', voice: 'Polly.Maxim' }).then((result) => {
|
||||
done(new Error("Invalid language voice combination should be rejected"));
|
||||
}).catch((err) => {
|
||||
assert.equal('<Speak> voice ‘Polly.Maxim’ is not valid. Refer <link> for list of supported voices.', err.message);
|
||||
done();
|
||||
});
|
||||
|
||||
response.addSpeak(speak_body, { language: 'Spanish-Castilian', voice: 'Polly.Maxim' });
|
||||
done()
|
||||
});
|
||||
|
||||
it('Ssml - Valid Language-Voice Combination', function (done) {
|
||||
|
|
@ -86,12 +66,8 @@ describe('SsmlInterface', function () {
|
|||
// Invalid speak body
|
||||
let speak_body = '<w>Here is a number</w>';
|
||||
|
||||
response.addSpeak(speak_body, { language: 'Spanish-Castilian', voice: 'Polly.Conchita' }).then((result) => {
|
||||
done();
|
||||
}).catch((err) => {
|
||||
done('Validate Language Voice combination should be accepted.');
|
||||
});
|
||||
|
||||
response.addSpeak(speak_body, { language: 'Spanish-Castilian', voice: 'Polly.Conchita' });
|
||||
done()
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
|||
36
test/xml.js
36
test/xml.js
|
|
@ -8,26 +8,24 @@ describe('PlivoXML', function () {
|
|||
response.addPreAnswer();
|
||||
response.addRecord();
|
||||
response.addHangup();
|
||||
response.addSpeak('text').then(function (result) {
|
||||
response.addWait();
|
||||
response.addDTMF('123');
|
||||
response.addConference('test');
|
||||
response.addRedirect('url');
|
||||
response.addGetDigits();
|
||||
response.addPlay('url');
|
||||
const dial = response.addDial();
|
||||
dial.addNumber('123');
|
||||
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('<Response><PreAnswer/><Record/><Hangup/><Speak>text</Speak><Wait/><DTMF>123</DTMF><Conference>test</Conference><Redirect>url</Redirect><GetDigits/><Play>url</Play><Dial><Number>123</Number><User>sip:test@sip.plivo.com</User></Dial><Message src="123" dst="456">∫test</Message></Response>', response.toXML());
|
||||
done();
|
||||
}).catch(function (err) {
|
||||
done("Failed to test Plivo Xml due to unknown error");
|
||||
dial.addUser('sip:test@sip.plivo.com');
|
||||
response.addMessage('∫test', {
|
||||
src: '123',
|
||||
dst: '456',
|
||||
});
|
||||
assert.equal('<Response><PreAnswer/><Record/><Hangup/><Speak>text</Speak><Wait/><DTMF>123</DTMF><Conference>test</Conference><Redirect>url</Redirect><GetDigits/><Play>url</Play><Dial><Number>123</Number><User>sip:test@sip.plivo.com</User></Dial><Message src="123" dst="456">∫test</Message></Response>', response.toXML());
|
||||
done();
|
||||
|
||||
});
|
||||
|
||||
it('tests MultiPartyCall', function (done){
|
||||
|
|
@ -39,5 +37,5 @@ describe('PlivoXML', function () {
|
|||
});
|
||||
assert.equal('<Response><MultiPartyCall role="Agent" maxDuration="1000" statusCallbackEvents="participant-speak-events, participant-digit-input-events, add-participant-api-events, participant-state-changes, mpc-state-changes" maxParticipants="10" waitMusicMethod="GET" agentHoldMusicMethod="GET" customerHoldMusicMethod="GET" record="false" recordFileFormat="mp3" recordingCallbackMethod="GET" statusCallbackMethod="POST" stayAlone="false" coachMode="true" mute="false" hold="false" startMpcOnEnter="true" endMpcOnExit="false" enterSound="beep:1" enterSoundMethod="GET" exitSound="beep:2" exitSoundMethod="GET" onExitActionMethod="POST" relayDTMFInputs="false">Nairobi</MultiPartyCall></Response>',mpcResponse.toXML());
|
||||
done();
|
||||
})
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue