From 2d7d84436aeeddf935a399689d9e7515b4e239f7 Mon Sep 17 00:00:00 2001 From: Quan HL Date: Sun, 7 May 2023 17:33:29 +0700 Subject: [PATCH] fix failing testcase --- lib/http-routes/api/create-call.js | 2 +- test/create-call-test.js | 64 +++++++++++++++--------------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/lib/http-routes/api/create-call.js b/lib/http-routes/api/create-call.js index 4924faf7..ab26d503 100644 --- a/lib/http-routes/api/create-call.js +++ b/lib/http-routes/api/create-call.js @@ -193,7 +193,7 @@ router.post('/', async(req, res) => { direction: CallDirection.Outbound, req: inviteReq, to, - tag: {...app.tag, ...req.body.metadata}, + tag: {...req.body.metadata, ...app.tag}, callSid, accountSid: req.body.account_sid, applicationSid: app.application_sid, diff --git a/test/create-call-test.js b/test/create-call-test.js index 983af5c4..1d9a900b 100644 --- a/test/create-call-test.js +++ b/test/create-call-test.js @@ -19,41 +19,41 @@ function connect(connectable) { }); } -// test('test create-call timeout', async(t) => { -// clearModule.all(); -// const {srf, disconnect} = require('../app'); +test('test create-call timeout', async(t) => { + clearModule.all(); + const {srf, disconnect} = require('../app'); -// try { -// await connect(srf); + 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); + // 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); -// post('v1/createCall', { -// 'account_sid':account_sid, -// 'timeout': 1, -// "call_hook": { -// "url": "https://public-apps.jambonz.us/hello-world", -// "method": "POST" -// }, -// "from": "15083718299", -// "to": { -// "type": "phone", -// "number": "15583084809" -// }}); -// //THEN -// await p; -// disconnect(); -// } catch (err) { -// console.log(`error received: ${err}`); -// disconnect(); -// t.error(err); -// } -// }); + // GIVEN + let account_sid = '622f62e4-303a-49f2-bbe0-eb1e1714e37a'; + const post = bent('http://127.0.0.1:3000/', 'POST', 'json', 201); + post('v1/createCall', { + 'account_sid':account_sid, + 'timeout': 1, + "call_hook": { + "url": "https://public-apps.jambonz.us/hello-world", + "method": "POST" + }, + "from": "15083718299", + "to": { + "type": "phone", + "number": "15583084809" + }}); + //THEN + await p; + disconnect(); + } catch (err) { + console.log(`error received: ${err}`); + disconnect(); + t.error(err); + } +}); test('test create-call call-hook basic authentication', async(t) => { clearModule.all();