mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
Merge branch 'feature/swagger20BundleSupport' into feat/response20
This commit is contained in:
@@ -55,6 +55,7 @@ let expect = require('chai').expect,
|
||||
SWAGGER_PETSTORE_FOLDER = path.join(__dirname, '../data/swaggerMultifile/petstore-separate-yaml'),
|
||||
additionalProperties20 = path.join(__dirname, SWAGGER_MULTIFILE_FOLDER + '/additionalProperties'),
|
||||
additionalProperties = path.join(__dirname, BUNDLES_FOLDER + '/additionalProperties'),
|
||||
referencedSecuritySchemes20 = path.join(__dirname, SWAGGER_MULTIFILE_FOLDER + '/referenced_security_schemes'),
|
||||
referencedResponse20 = path.join(__dirname, SWAGGER_MULTIFILE_FOLDER + '/referenced_response');
|
||||
|
||||
describe('bundle files method - 3.0', function () {
|
||||
@@ -2548,6 +2549,38 @@ describe('bundle files method - 2.0', function() {
|
||||
expect(JSON.stringify(res.output.data[0].bundledContent, null, 2)).to.be.equal(expected);
|
||||
});
|
||||
|
||||
it('Should return bundled file - referenced Security Schemes', async function () {
|
||||
let contentRootFile = fs.readFileSync(referencedSecuritySchemes20 + '/root.yaml', 'utf8'),
|
||||
contentRef = fs.readFileSync(referencedSecuritySchemes20 + '/sschemes.yaml', 'utf8'),
|
||||
expected = fs.readFileSync(referencedSecuritySchemes20 + '/expected.json', 'utf8'),
|
||||
input = {
|
||||
type: 'multiFile',
|
||||
specificationVersion: '2.0',
|
||||
rootFiles: [
|
||||
{
|
||||
path: '/root.yaml'
|
||||
}
|
||||
],
|
||||
data: [
|
||||
{
|
||||
path: '/root.yaml',
|
||||
content: contentRootFile
|
||||
},
|
||||
{
|
||||
path: '/sschemes.yaml',
|
||||
content: contentRef
|
||||
}
|
||||
],
|
||||
options: {},
|
||||
bundleFormat: 'JSON'
|
||||
};
|
||||
const res = await Converter.bundle(input);
|
||||
|
||||
expect(res).to.not.be.empty;
|
||||
expect(res.result).to.be.true;
|
||||
expect(JSON.stringify(res.output.data[0].bundledContent, null, 2)).to.be.equal(expected);
|
||||
});
|
||||
|
||||
it('Should bundle file from - referenced response 2.0', async function() {
|
||||
let contentRootFile = fs.readFileSync(referencedResponse20 + '/root.yaml', 'utf8'),
|
||||
referenced = fs.readFileSync(referencedResponse20 + '/response.yaml', 'utf8'),
|
||||
@@ -2574,6 +2607,7 @@ describe('bundle files method - 2.0', function() {
|
||||
bundleFormat: 'JSON'
|
||||
};
|
||||
const res = await Converter.bundle(input);
|
||||
|
||||
expect(res).to.not.be.empty;
|
||||
expect(res.result).to.be.true;
|
||||
expect(JSON.stringify(res.output.data[0].bundledContent, null, 2)).to.be.equal(expected);
|
||||
|
||||
Reference in New Issue
Block a user