Test fixes + handling no-matching-paths condition correctly

This commit is contained in:
Abhijit Kane
2019-12-19 09:57:11 +05:30
parent bbc7c5e02f
commit 4a244c9e08
2 changed files with 10 additions and 6 deletions

View File

@@ -289,7 +289,8 @@ class SchemaPack {
});
});
}, (err, result) => {
var singleMismatch = false;
var singleMismatch = false,
retVal;
// determine if any endpoint for any request misatched
_.each(result, (reqRes) => {
let thisMismatch = false;
@@ -305,10 +306,13 @@ class SchemaPack {
}
});
callback(null, {
matched: !singleMismatch,
requests: _.keyBy(result, 'requestId')
});
retVal = {
matched: !singleMismatch
};
if (singleMismatch && result) {
retVal.requests = _.keyBy(result, 'requestId');
}
callback(null, retVal);
});

View File

@@ -18,7 +18,7 @@ describe('The converter must validate a history request against the schema', fun
let schemaPack = new Converter.SchemaPack({ type: 'json', data: openapi }, {});
schemaPack.validateTransaction(historyRequest, (err, result) => {
expect(err).to.be.null;
expect(result).to.be.an.object;
expect(result).to.be.an('object');
done();
});
});