Skip to content
This repository was archived by the owner on May 15, 2023. It is now read-only.

Commit 43501ff

Browse files
committed
Merge pull request #86 from apigee-127/path-option-fix
fix empty path option array wouldnt write tests
2 parents 1c3c39e + 1736b57 commit 43501ff

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ function testGen(swagger, config) {
416416
var filename;
417417
var schemaTemp;
418418
var environment;
419+
var ndx = 0;
419420

420421

421422
source = read(join(__dirname, 'templates/schema.handlebars'), 'utf8');
@@ -429,7 +430,7 @@ function testGen(swagger, config) {
429430
len = config.maxLen;
430431
}
431432

432-
if (config.pathName.length === 0) {
433+
if (!targets || targets.length === 0) {
433434
// builds tests for all paths in API
434435
_.forEach(paths, function(path, pathName) {
435436
result.push(testGenPath(swagger, pathName, config));
@@ -442,7 +443,7 @@ function testGen(swagger, config) {
442443
}
443444

444445
// no specified paths to build, so build all of them
445-
if (config.pathName.length === 0) {
446+
if (!targets || targets.length === 0) {
446447
_.forEach(result, function(results) {
447448
output.push({
448449
name: '-test.js',
@@ -475,7 +476,7 @@ function testGen(swagger, config) {
475476
}
476477
output.push({
477478
name: filename,
478-
test: target
479+
test: result[ndx++]
479480
});
480481
});
481482
}

test/deprecated/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var read = require('fs').readFileSync;
3636
rules = yaml.safeLoad(read(join(__dirname, '/../../.eslintrc'), 'utf8'));
3737
rules.env = {mocha: true};
3838

39-
describe('security swagger', function() {
39+
describe('deprecated swagger', function() {
4040
describe('assert-option', function() {
4141
describe('expect', function() {
4242
var output1 = testGen(swagger, {

0 commit comments

Comments
 (0)