Skip to content

Commit

Permalink
Switch to 'sway' for validation
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Sep 28, 2015
1 parent ce1d01d commit 1cc86b5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"mocha-jscs": "^1.1.0",
"mocha-jshint": "2.2.3",
"seamless-immutable": "^3.0.0",
"swagger-tools": "^0.9.0",
"sway": "^0.3.0",
"uglify-js": "^2.4.16"
},
"dependencies": {
Expand Down
15 changes: 8 additions & 7 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var fs = require('fs');
var path = require('path');
var convert = require('..');
var expect = require('chai').expect;
var SwaggerTools = require('swagger-tools');
var sway = require('sway');
var Immutable = require('seamless-immutable');
var inputPath = './test/input/';
var outputPath = './test/output/';
Expand Down Expand Up @@ -94,12 +94,13 @@ function testInput(input) {
});

it('should generate valid Swagger 2.0 document', function() {
function validateCallback(validationErrors, validationResults) {
var errors = [].concat(validationErrors || [])
.concat((validationResults && validationResults.errors) || []);
expect(errors).to.deep.equal([]);
}
SwaggerTools.specs.v2.validate(converted, validateCallback);
return sway.create({definition: converted})
.then(function(swaggerObj) {
swaggerObj.validate();
expect(swaggerObj.getLastErrors()).to.deep.equal([]);
//TODO: fix all warings and uncomment
//expect(swaggerObj.getLastWarnings()).to.deep.equal([]);
});
});

it('should produce the same output as output file', function() {
Expand Down

0 comments on commit 1cc86b5

Please sign in to comment.