fix: uncomment testsuite (#234)

* fix: uncomment testsuite

* fix: uncomment testsuite

* fix: unstable testcases

* fix: uncomment testsuite

* fix: uncomment testsuite

* fix: uncomment testsuite

* fix: uncomment testsuite

* fix: uncomment testsuite

* fix: uncomment testsuite

* fix: unstable testcase

* fix: uncomment testsuite

* wip: test

* wip: test

* wip: test

Co-authored-by: Quan HL <quanluuhoang8@gmail.com>
This commit is contained in:
Hoan Luu Huu
2023-01-27 19:27:53 +07:00
committed by GitHub
parent 4b3ebe37ac
commit 14a02735be
3 changed files with 17 additions and 21 deletions

View File

@@ -22,6 +22,8 @@ test('\'dial-phone\'', async(t) => {
const {srf, disconnect} = require('../app'); const {srf, disconnect} = require('../app');
try { try {
await connect(srf); await connect(srf);
// wait for fs connected to drachtio server.
await new Promise(r => setTimeout(r, 1000));
// GIVEN // GIVEN
const from = "dial_success"; const from = "dial_success";
@@ -46,15 +48,12 @@ test('\'dial-phone\'', async(t) => {
const p = sippUac('uas-dial.xml', '172.38.0.10', undefined, undefined, 2); const p = sippUac('uas-dial.xml', '172.38.0.10', undefined, undefined, 2);
let account_sid = '622f62e4-303a-49f2-bbe0-eb1e1714e37a'; let account_sid = '622f62e4-303a-49f2-bbe0-eb1e1714e37a';
let post = bent('http://127.0.0.1:3000/', 'POST', 'json', 201); let post = bent('http://127.0.0.1:3000/', 'POST', 'json', 201);
post('v1/createCall', { post('v1/createCall', {
'account_sid':account_sid, 'account_sid':account_sid,
"call_hook": { "call_hook": {
"url": "http://127.0.0.1:3100/", "url": "http://127.0.0.1:3100/",
"method": "POST", "method": "POST",
"username": "username",
"password": "password"
}, },
"from": from, "from": from,
"to": { "to": {
@@ -82,7 +81,8 @@ test('\'dial-sip\'', async(t) => {
const {srf, disconnect} = require('../app'); const {srf, disconnect} = require('../app');
try { try {
await connect(srf); await connect(srf);
// wait for fs connected to drachtio server.
await new Promise(r => setTimeout(r, 1000));
// GIVEN // GIVEN
const from = "dial_sip"; const from = "dial_sip";
let verbs = [ let verbs = [
@@ -113,8 +113,6 @@ test('\'dial-sip\'', async(t) => {
"call_hook": { "call_hook": {
"url": "http://127.0.0.1:3100/", "url": "http://127.0.0.1:3100/",
"method": "POST", "method": "POST",
"username": "username",
"password": "password"
}, },
"from": from, "from": from,
"to": { "to": {
@@ -151,7 +149,8 @@ test('\'dial-user\'', async(t) => {
const {srf, disconnect} = require('../app'); const {srf, disconnect} = require('../app');
try { try {
await connect(srf); await connect(srf);
// wait for fs connected to drachtio server.
await new Promise(r => setTimeout(r, 1000));
// GIVEN // GIVEN
const from = "dial_user"; const from = "dial_user";
let verbs = [ let verbs = [
@@ -181,8 +180,6 @@ test('\'dial-user\'', async(t) => {
"call_hook": { "call_hook": {
"url": "http://127.0.0.1:3100/", "url": "http://127.0.0.1:3100/",
"method": "POST", "method": "POST",
"username": "username",
"password": "password"
}, },
"from": from, "from": from,
"to": { "to": {

View File

@@ -1,16 +1,16 @@
require('./unit-tests'); require('./unit-tests');
require('./docker_start'); require('./docker_start');
require('./create-test-db'); require('./create-test-db');
// require('./account-validation-tests'); require('./account-validation-tests');
// require('./dial-tests'); require('./dial-tests');
// require('./webhooks-tests'); require('./webhooks-tests');
// require('./say-tests'); require('./say-tests');
// require('./gather-tests'); require('./gather-tests');
// require('./transcribe-tests'); require('./transcribe-tests');
// require('./sip-request-tests'); require('./sip-request-tests');
// require('./create-call-test'); require('./create-call-test');
require('./play-tests'); require('./play-tests');
// require('./sip-refer-tests'); require('./sip-refer-tests');
// require('./listen-tests'); require('./listen-tests');
require('./remove-test-db'); require('./remove-test-db');
require('./docker_stop'); require('./docker_stop');

View File

@@ -223,7 +223,6 @@ test('\'play\' tests with earlymedia', async(t) => {
// THEN // THEN
await sippUac('uac-invite-expect-183-cancel.xml', '172.38.0.10', from); await sippUac('uac-invite-expect-183-cancel.xml', '172.38.0.10', from);
const obj = await getJSON(`http:127.0.0.1:3100/lastRequest/${from}_callStatus`); const obj = await getJSON(`http:127.0.0.1:3100/lastRequest/${from}_callStatus`);
console.log(obj);
t.ok(obj.body.sip_status === 487, "play: actionHook success received"); t.ok(obj.body.sip_status === 487, "play: actionHook success received");
t.ok(obj.body.sip_reason === 'Request Terminated', "play: actionHook success received"); t.ok(obj.body.sip_reason === 'Request Terminated', "play: actionHook success received");
t.ok(obj.body.call_termination_by === 'caller', "play: actionHook success received"); t.ok(obj.body.call_termination_by === 'caller', "play: actionHook success received");