Issue with empty roots bundle

This commit is contained in:
Luis Tejeda
2022-06-03 16:34:23 -05:00
parent 0bba8a4895
commit 7b5e68b2b6
3 changed files with 53 additions and 34 deletions

View File

@@ -419,12 +419,14 @@ describe('bundle files method - 3.0', function () {
}
]
};
const res = await Converter.bundle(input);
expect(res).to.not.be.empty;
expect(res.result).to.be.false;
expect(res.reason).to.equal('Invalid format. Input must be in YAML or JSON ' +
'format. Specification is not a valid YAML. YAMLException: duplicated mapping' +
' key at line 30, column -54:\n components:\n ^');
try {
await Converter.bundle(input);
}
catch (error) {
expect(error.message).to.equal('Invalid format. Input must be in YAML or JSON ' +
'format. Specification is not a valid YAML. YAMLException: duplicated mapping' +
' key at line 30, column -54:\n components:\n ^');
}
});
it('Should return bundled file from same_ref_different_source', async function () {
@@ -830,6 +832,35 @@ describe('bundle files method - 3.0', function () {
expect(error.message).to.equal('Input object must have "type" and "data" information');
}
});
it('should return error when input has no root files', async function () {
let contentRootFile = fs.readFileSync(refExample + '/root.yaml', 'utf8'),
input = {
type: 'folder',
specificationVersion: '3.0',
rootFiles: [],
data: [
{
path: '/root.yaml',
content: contentRootFile
},
{
path: '/root.yaml',
content: contentRootFile
}
],
options: {},
bundleFormat: 'JSON'
};
try {
await Converter.bundle(input);
}
catch (error) {
expect(error).to.not.be.undefined;
expect(error.message).to.equal('"RootFiles" parameter should be provided');
}
});
});
describe('bundle files method - 2.0', function() {