feat: play verb url support single or array list url (#158)

* feat: update time-series 0.11.12

* feat: support play verb url in plain text or array

* fix: review comment

Co-authored-by: Dave Horton <daveh@beachdognet.com>
This commit is contained in:
xquanluu
2022-08-25 15:09:48 +07:00
committed by GitHub
parent 4f0439dad9
commit 127432f2ec
14 changed files with 323 additions and 20 deletions

View File

@@ -2,9 +2,11 @@ const test = require('tape');
const { sippUac } = require('./sipp')('test_fs');
const bent = require('bent');
const clearModule = require('clear-module');
const provisionCallHook = require('./utils')
const {provisionCallHook} = require('./utils')
const getJSON = bent('json')
const waitFor = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
});
@@ -23,6 +25,11 @@ test('test create-call timeout', async(t) => {
try {
await connect(srf);
// give UAS app time to come up
const p = sippUac('uas-timeout-cancel.xml', '172.38.0.10');
await waitFor(1000);
// GIVEN
let account_sid = '622f62e4-303a-49f2-bbe0-eb1e1714e37a';
const post = bent('http://127.0.0.1:3000/', 'POST', 'json', 201);
@@ -39,7 +46,7 @@ test('test create-call timeout', async(t) => {
"number": "15583084809"
}});
//THEN
await sippUac('uas-timeout-cancel.xml', '172.38.0.10');
await p;
disconnect();
} catch (err) {
console.log(`error received: ${err}`);
@@ -54,10 +61,16 @@ test('test create-call call-hook basic authentication', async(t) => {
try {
await connect(srf);
// GIVEN
let from = 'call_hook_basic_authentication';
let account_sid = '622f62e4-303a-49f2-bbe0-eb1e1714e37a';
// Give UAS app time to come up
const p = sippUac('uas.xml', '172.38.0.10', from);
await waitFor(1000);
const post = bent('http://127.0.0.1:3000/', 'POST', 'json', 201);
post('v1/createCall', {
'account_sid':account_sid,
@@ -81,7 +94,7 @@ test('test create-call call-hook basic authentication', async(t) => {
];
provisionCallHook(from, verbs);
//THEN
await sippUac('uas.xml', '172.38.0.10', from);
await p;
let obj = await getJSON(`http:127.0.0.1:3100/lastRequest/${from}`)
t.ok(obj.headers.Authorization = 'Basic dXNlcm5hbWU6cGFzc3dvcmQ=',