From 1736b5704ebe570d7002b437b0d339e4ad13825e Mon Sep 17 00:00:00 2001 From: Noah Dietz Date: Mon, 17 Aug 2015 09:32:57 -0700 Subject: [PATCH] fix empty path option array wouldnt write tests --- index.js | 7 ++++--- test/deprecated/test.js | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 717ea6f..eb9e469 100644 --- a/index.js +++ b/index.js @@ -416,6 +416,7 @@ function testGen(swagger, config) { var filename; var schemaTemp; var environment; + var ndx = 0; source = read(join(__dirname, 'templates/schema.handlebars'), 'utf8'); @@ -429,7 +430,7 @@ function testGen(swagger, config) { len = config.maxLen; } - if (config.pathName.length === 0) { + if (!targets || targets.length === 0) { // builds tests for all paths in API _.forEach(paths, function(path, pathName) { result.push(testGenPath(swagger, pathName, config)); @@ -442,7 +443,7 @@ function testGen(swagger, config) { } // no specified paths to build, so build all of them - if (config.pathName.length === 0) { + if (!targets || targets.length === 0) { _.forEach(result, function(results) { output.push({ name: '-test.js', @@ -475,7 +476,7 @@ function testGen(swagger, config) { } output.push({ name: filename, - test: target + test: result[ndx++] }); }); } diff --git a/test/deprecated/test.js b/test/deprecated/test.js index c2a6226..9ccfba8 100644 --- a/test/deprecated/test.js +++ b/test/deprecated/test.js @@ -36,7 +36,7 @@ var read = require('fs').readFileSync; rules = yaml.safeLoad(read(join(__dirname, '/../../.eslintrc'), 'utf8')); rules.env = {mocha: true}; -describe('security swagger', function() { +describe('deprecated swagger', function() { describe('assert-option', function() { describe('expect', function() { var output1 = testGen(swagger, {