Skip to content

Commit

Permalink
Fix test for relative references support
Browse files Browse the repository at this point in the history
  • Loading branch information
lumaxis committed Dec 22, 2016
1 parent 1aaf5ed commit fdac8fc
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions test/test-issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,20 @@ describe('issues', function () {
});

it('should support relative references (and to YAML files) (Issue 17)', function (done) {
Sway.create({
definition: helpers.swaggerDocRelativeRefsPath
helpers.getSwaggerApiRelativeRefs(function (swaggerApiRelativeRefs) {
assert.ok(_.isUndefined(swaggerApiRelativeRefs.definitionFullyResolved.info.$ref));
assert.ok(Object.keys(swaggerApiRelativeRefs.definitionFullyResolved.definitions).length > 1);
assert.ok(Object.keys(swaggerApiRelativeRefs.definitionFullyResolved.paths).length > 1);
assert.equal(swaggerApiRelativeRefs.definitionFullyResolved.info.title, 'Swagger Petstore');
assert.ok(_.isPlainObject(swaggerApiRelativeRefs.definitionFullyResolved.definitions.Pet));
assert.ok(_.isPlainObject(swaggerApiRelativeRefs.definitionFullyResolved.paths['/pet/{petId}'].get));

_.each(swaggerApiRelativeRefs.references, function (entry) {
assert.ok(typeof entry.missing === 'undefined');
});

done();
})
.then(function () {
assert.ok(_.isUndefined(swaggerApi.definitionFullyResolved.info.$ref));
assert.ok(Object.keys(swaggerApi.definitionFullyResolved.definitions).length > 1);
assert.ok(Object.keys(swaggerApi.definitionFullyResolved.paths).length > 1);
assert.equal(swaggerApi.definitionFullyResolved.info.title, 'Swagger Petstore');
assert.ok(_.isPlainObject(swaggerApi.definitionFullyResolved.definitions.Pet));
assert.ok(_.isPlainObject(swaggerApi.definitionFullyResolved.paths['/pet/{petId}'].get));

_.each(swaggerApi.references, function (entry) {
assert.ok(typeof entry.missing === 'undefined');
});
})
.then(done, done);
});

it('should not throw an error for unknown formats (Issue 20)', function (done) {
Expand Down

0 comments on commit fdac8fc

Please sign in to comment.