mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
Fix defintions replacing instead of merging
Fix defintions replacing instead of merging
This commit is contained in:
@@ -28,7 +28,8 @@ let expect = require('chai').expect,
|
||||
refTags20 = path.join(__dirname, SWAGGER_MULTIFILE_FOLDER + '/referenced_tags'),
|
||||
basicExample = path.join(__dirname, SWAGGER_MULTIFILE_FOLDER + '/basicExample'),
|
||||
simpleRef = path.join(__dirname, SWAGGER_MULTIFILE_FOLDER + '/simpleRef'),
|
||||
refPaths20 = path.join(__dirname, SWAGGER_MULTIFILE_FOLDER + '/referenced_paths');
|
||||
refPaths20 = path.join(__dirname, SWAGGER_MULTIFILE_FOLDER + '/referenced_paths'),
|
||||
refPathsRefToLocalSchema20 = path.join(__dirname, SWAGGER_MULTIFILE_FOLDER + '/referenced_paths_local_schema');
|
||||
|
||||
describe('bundle files method - 3.0', function () {
|
||||
it('Should return bundled file as json - schema_from_response', async function () {
|
||||
@@ -913,6 +914,39 @@ describe('bundle files method - 2.0', function () {
|
||||
expect(res.result).to.be.true;
|
||||
expect(res.output.data.bundledContent).to.be.equal(expected);
|
||||
});
|
||||
|
||||
it('Should return bundled file with referenced paths from root - path references local schema', async function () {
|
||||
let contentRootFile = fs.readFileSync(refPathsRefToLocalSchema20 + '/root.yaml', 'utf8'),
|
||||
paths = fs.readFileSync(refPathsRefToLocalSchema20 + '/paths/paths.yaml', 'utf8'),
|
||||
path = fs.readFileSync(refPathsRefToLocalSchema20 + '/paths/path.yaml', 'utf8'),
|
||||
expected = fs.readFileSync(refPathsRefToLocalSchema20 + '/expected.json', 'utf8'),
|
||||
input = {
|
||||
type: 'folder',
|
||||
specificationVersion: '2.0',
|
||||
rootFiles: [
|
||||
{
|
||||
path: '/root.yaml',
|
||||
content: contentRootFile
|
||||
}
|
||||
],
|
||||
data: [
|
||||
{
|
||||
path: '/paths/paths.yaml',
|
||||
content: paths
|
||||
},
|
||||
{
|
||||
path: '/paths/path.yaml',
|
||||
content: path
|
||||
}
|
||||
],
|
||||
options: {},
|
||||
bundleFormat: 'JSON'
|
||||
};
|
||||
const res = await Converter.bundle(input);
|
||||
expect(res).to.not.be.empty;
|
||||
expect(res.result).to.be.true;
|
||||
expect(res.output.data.bundledContent).to.be.equal(expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getReferences method when node does not have any reference', function() {
|
||||
|
||||
Reference in New Issue
Block a user