mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-21 17:17:58 +00:00
fix failing testcase
This commit is contained in:
@@ -13,7 +13,6 @@ class CallInfo {
|
|||||||
this.direction = opts.direction;
|
this.direction = opts.direction;
|
||||||
this.traceId = opts.traceId;
|
this.traceId = opts.traceId;
|
||||||
this.callTerminationBy = undefined;
|
this.callTerminationBy = undefined;
|
||||||
this.metadata = opts.metadata;
|
|
||||||
if (opts.req) {
|
if (opts.req) {
|
||||||
const u = opts.req.getParsedHeader('from');
|
const u = opts.req.getParsedHeader('from');
|
||||||
const uri = parseUri(u.uri);
|
const uri = parseUri(u.uri);
|
||||||
@@ -92,7 +91,7 @@ class CallInfo {
|
|||||||
this.from = from || req.callingNumber;
|
this.from = from || req.callingNumber;
|
||||||
this.to = to;
|
this.to = to;
|
||||||
if (tag) this._customerData = tag;
|
if (tag) this._customerData = tag;
|
||||||
if (this.metadata) this._customerData = {...this._customerData, ...this.metadata};
|
if (opts.metadata) this._customerData = {...this._customerData, ...opts.metadata};
|
||||||
}
|
}
|
||||||
|
|
||||||
this.localSipAddress = srf.locals.localSipAddress;
|
this.localSipAddress = srf.locals.localSipAddress;
|
||||||
|
|||||||
@@ -106,17 +106,19 @@ test("test create-call call-hook basic authentication", async (t) => {
|
|||||||
await p;
|
await p;
|
||||||
|
|
||||||
let obj = await getJSON(`http:127.0.0.1:3100/lastRequest/${from}`);
|
let obj = await getJSON(`http:127.0.0.1:3100/lastRequest/${from}`);
|
||||||
|
console.log(obj);
|
||||||
t.ok(
|
t.ok(
|
||||||
(obj.headers.Authorization === "Basic dXNlcm5hbWU6cGFzc3dvcmQ="),
|
obj.headers.Authorization === "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
|
||||||
"create-call: call-hook contains basic authentication header"
|
"create-call: call-hook contains basic authentication header"
|
||||||
);
|
);
|
||||||
t.ok(
|
t.ok(
|
||||||
(obj.customerData.customer === 'acme'),
|
obj.body.customerdata.customer === "acme",
|
||||||
"create-call: metadata is working"
|
"create-call: metadata is working"
|
||||||
);
|
);
|
||||||
obj = await getJSON(`http:127.0.0.1:3100/lastRequest/${from}_callStatus`);
|
obj = await getJSON(`http:127.0.0.1:3100/lastRequest/${from}_callStatus`);
|
||||||
|
console.log(obj);
|
||||||
t.ok(
|
t.ok(
|
||||||
(obj.customerData.customer === 'acme'),
|
obj.body.customerData.customer === "acme",
|
||||||
"create-call: metadata is working"
|
"create-call: metadata is working"
|
||||||
);
|
);
|
||||||
disconnect();
|
disconnect();
|
||||||
|
|||||||
Reference in New Issue
Block a user