-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
66 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,11 +9,15 @@ var assert = require('assert'); | |
var util = require('util'); | ||
|
||
var sayExpected = '{"tropo":[{"say":{"value":"Hello, World.","required":true,"voice":"carmen"}}]}'; | ||
var say1Expected = '{"tropo":[{"say":{"value":"Hello, World.","required":true,"voice":"carmen","media":"http://user:[email protected]/1.jpg"}}]}'; | ||
var say2Expected = '{"tropo":[{"say":{"value":"Hello, World.","required":true,"voice":"carmen","media":["http://server.com/1.jpg","this is a inline text content","http://filehosting.tropo.com/account/1/2.text"]}}]}'; | ||
var askExpected = '{"tropo":[{"ask":{"choices":{"value":"[5 DIGITS]"},"say":{"value":"Please say your account number."},"bargein":true,"required":true,"timeout":30}}]}'; | ||
var callExpected = '{"tropo":[{"call":{"to":"3055195825"}}]}'; | ||
var conferenceExpected = '{"tropo":[{"conference":{"id":"1234","mute":false,"playTones":false,"terminator":"#"}}]}'; | ||
var hangupExpected = '{"tropo":[{"hangup":{}}]}'; | ||
var messageExpected = '{"tropo":[{"message":{"say":{"value":"This is an announcement"},"to":"3055195825","answerOnMedia":false,"channel":"TEXT","from":"3055551212","network":"SMS","timeout":10,"voice":"kate"}}]}'; | ||
var message1Expected = '{"tropo":[{"message":{"say":{"value":"This is an announcement","media":"http://user:[email protected]/1.jpg"},"to":"3055195825","answerOnMedia":false,"channel":"TEXT","from":"3055551212","network":"MMS","timeout":10,"voice":"kate"}}]}'; | ||
var message2Expected = '{"tropo":[{"message":{"say":{"value":"This is an announcement","media":["http://server.com/1.jpg","this is a inline text content","http://filehosting.tropo.com/account/1/2.text"]},"to":"3055195825","answerOnMedia":false,"channel":"TEXT","from":"3055551212","network":"MMS","timeout":10,"voice":"kate"}}]}'; | ||
var recordExpected = '{"tropo":[{"record":{"beep":true,"choices":{"terminator":"#"},"maxSilence":5,"method":"POST","required":true,"say":{"value":"Please say your account number"}}}]}'; | ||
|
||
var numTests = 0; | ||
|
@@ -22,11 +26,15 @@ var numFailed = 0; | |
console.log('***** Starting Test Run ************'); | ||
console.log(' '); | ||
console.log('Say Test: ' + sayTest(sayExpected)); | ||
console.log('Say Test1: ' + say1Test(say1Expected)); | ||
console.log('Say Test2: ' + say2Test(say2Expected)); | ||
console.log('Ask Test: ' + askTest(askExpected)); | ||
console.log('Call Test: ' + callTest(callExpected)); | ||
console.log('Conference Test: ' + conferenceTest(conferenceExpected)); | ||
console.log('Hangup Test: ' + hangupTest(hangupExpected)); | ||
console.log('Message Test: ' + messageTest(messageExpected)); | ||
console.log('Message Test1: ' + message1Test(message1Expected)); | ||
console.log('Message Test2: ' + message2Test(message2Expected)); | ||
console.log('Record Test: ' + recordTest(recordExpected)); | ||
console.log(''); | ||
console.log('Total Tests Run: ' + numTests); | ||
|
@@ -43,6 +51,22 @@ function sayTest(expected) { | |
|
||
} | ||
|
||
function say1Test(expected) { | ||
|
||
var tropo = new TropoWebAPI(); | ||
tropo.say("Hello, World.", null, null, null, true, "carmen", null, null, "http://user:[email protected]/1.jpg"); | ||
return runTest(TropoJSON(tropo), expected); | ||
|
||
} | ||
|
||
function say2Test(expected) { | ||
|
||
var tropo = new TropoWebAPI(); | ||
tropo.say("Hello, World.", null, null, null, true, "carmen", null, null, new Array("http://server.com/1.jpg","this is a inline text content","http://filehosting.tropo.com/account/1/2.text")); | ||
return runTest(TropoJSON(tropo), expected); | ||
|
||
} | ||
|
||
// A test for the Tropo Ask object. | ||
function askTest(expected) { | ||
|
||
|
@@ -87,6 +111,24 @@ function messageTest(expected) { | |
|
||
} | ||
|
||
function message1Test(expected) { | ||
|
||
var tropo = new TropoWebAPI(); | ||
var say = new Say("This is an announcement", null, null, null, null, null, null, null, "http://user:[email protected]/1.jpg"); | ||
tropo.message(say, "3055195825", false, "TEXT", "3055551212", null, "MMS", null, 10, "kate"); | ||
return runTest(TropoJSON(tropo), expected); | ||
|
||
} | ||
|
||
function message2Test(expected) { | ||
|
||
var tropo = new TropoWebAPI(); | ||
var say = new Say("This is an announcement", null, null, null, null, null, null, null, new Array("http://server.com/1.jpg","this is a inline text content","http://filehosting.tropo.com/account/1/2.text")); | ||
tropo.message(say, "3055195825", false, "TEXT", "3055551212", null, "MMS", null, 10, "kate"); | ||
return runTest(TropoJSON(tropo), expected); | ||
|
||
} | ||
|
||
// A test for the Tropo Record object. | ||
function recordTest(expected) { | ||
|
||
|