mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
added tests for function readSpecFile
This commit is contained in:
4
index.js
4
index.js
@@ -83,13 +83,11 @@ module.exports = {
|
|||||||
output: convertedCollections
|
output: convertedCollections
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line no-else-return
|
|
||||||
else {
|
|
||||||
return cb(null, {
|
return cb(null, {
|
||||||
result: false,
|
result: false,
|
||||||
reason: reasonForFail
|
reason: reasonForFail
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line no-else-return
|
// eslint-disable-next-line no-else-return
|
||||||
|
|||||||
@@ -43,4 +43,20 @@ describe('PARSE FUNCTION TESTS', function() {
|
|||||||
|
|
||||||
expect(result.openapi).to.equal('3.0.0');
|
expect(result.openapi).to.equal('3.0.0');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('readSpecFile function', function() {
|
||||||
|
it('Should return the content from a remote file', function() {
|
||||||
|
let file = 'https://raw.githubusercontent.com/OAI/OpenAPI-Specification' +
|
||||||
|
'/master/examples/v3.0/api-with-examples.yaml';
|
||||||
|
parse.readSpecFile(file).then((result) => {
|
||||||
|
expect(result.startsWith('openapi: "3.0.0"')).to.equal(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('Should return the content from a local file', function() {
|
||||||
|
let file = path.join(__dirname, '../data/valid_openapi/petstore.yaml');
|
||||||
|
parse.readSpecFile(file).then((result) => {
|
||||||
|
expect(result.startsWith('openapi: 3.0.0')).to.equal(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user