mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
Test fixes + handling no-matching-paths condition correctly
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user