Skip to content

Commit

Permalink
Fix the lint and unit test issue
Browse files Browse the repository at this point in the history
  • Loading branch information
subeeshcbabu committed Oct 11, 2016
1 parent 360840f commit 67063e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ module.exports.isInteger = function(value) {
};

module.exports.isFinite = function(value) {
return typeof value === "number" && isFinite(value);
return typeof value === 'number' && isFinite(value);
};
9 changes: 5 additions & 4 deletions tests/param_mockgen.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var Assert = require('assert');
var Swagmock = require('../lib');
var Path = require('path')
var Path = require('path');
var Util = require('../lib/util');
//isInteger pollyfil for pre es6
Number.isInteger = Number.isInteger || function(value) {
return typeof value === "number" &&
Expand Down Expand Up @@ -58,16 +59,16 @@ describe('Parameter Mock generator', function () {
Assert.ok(Number.isInteger(params.path[0].value), 'OK value for petId');
Assert.ok(params.path[0].value >= 1000 && params.path[0].value <= 2000, 'OK value for petId');
Assert.ok(params.query, 'Generated query parameter');
params.query.forEach(param => {
params.query.forEach(function (param) {
if (param.name === 'petName') {
Assert.ok(/awesome+ (pet|cat|bird)/.test(param.value), 'OK value for petName');
}
if (param.name === 'petWeight') {
Assert.ok(Number.isFinite(param.value), 'OK value for petWeight');
Assert.ok(Util.isFinite(param.value), 'OK value for petWeight');
Assert.ok(param.value <= 500 && param.value >= 10, 'OK value for petWeight');
}
if (param.name === 'bmi') {
Assert.ok(Number.isFinite(param.value), 'OK value for bmi');
Assert.ok(Util.isFinite(param.value), 'OK value for bmi');
Assert.ok(param.value <= 1 && param.value >= 0, 'OK value for bmi');
}
});
Expand Down

0 comments on commit 67063e4

Please sign in to comment.