diff --git a/index.js b/index.js index 7faa1e6..050c6d5 100644 --- a/index.js +++ b/index.js @@ -256,6 +256,7 @@ function testGenResponse(swagger, apiPath, operation, response, config, consume, data.contentType = consume; data.returnType = produce; + data.requestParameters = {}; // compile template source and return test string var templatePath = path.join(config.templatesPath, config.testModule, operation, operation + '.handlebars'); @@ -267,6 +268,13 @@ function testGenResponse(swagger, apiPath, operation, response, config, consume, result = ''; for (var i = 0; i < data.requestData.length; i++) { data.request = JSON.stringify(data.requestData[i].body); + + for (var key in data.requestData[i]) { + if (['body', 'description'].indexOf(key) === -1) { + data.requestParameters[key] = data.requestData[i][key]; + } + } + data.requestMessage = data.requestData[i].description.replace(/'/g, "\\'"); // eslint-disable-line quotes result += templateFn(data); } @@ -550,6 +558,7 @@ handlebars.registerHelper('validateResponse', helpers.validateResponse); handlebars.registerHelper('length', helpers.length); handlebars.registerHelper('pathify', helpers.pathify); handlebars.registerHelper('printJSON', helpers.printJSON); +handlebars.registerHelper('requestDataParamFormatter', helpers.requestDataParamFormatter); module.exports = { diff --git a/lib/helpers.js b/lib/helpers.js index 1323ff5..ee570fe 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -14,7 +14,8 @@ module.exports = { pathify: pathify, printJSON: printJSON, len: len, - setLen: setLen + setLen: setLen, + requestDataParamFormatter : requestDataParamFormatter }; function setLen(descriptionLength) { @@ -190,3 +191,17 @@ function prettyPrintJson(obj, indent) { } return result.replace(/,\n$/, ''); } + + +function requestDataParamFormatter(paramName, paramType, requestParameters){ + var delimiter = "'"; + if (['integer', 'number', 'boolean', 'null'].indexOf(paramType.toLowerCase()) > -1) { + delimiter = ''; + } + + if (typeof requestParameters[paramName] != 'undefined') { + return delimiter + requestParameters[paramName] + delimiter; + } + + return "'DATA GOES HERE'"; +} \ No newline at end of file diff --git a/templates/request/delete/delete.handlebars b/templates/request/delete/delete.handlebars index e30001e..d05519a 100644 --- a/templates/request/delete/delete.handlebars +++ b/templates/request/delete/delete.handlebars @@ -10,7 +10,7 @@ {{#ifCond queryParameters queryApiKey}} qs: { {{#if queryApiKey}}{{queryApiKey.type}}: process.env.{{queryApiKey.name}}{{#if queryParameters}}, - {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: 'DATA GOES HERE'{{#unless @last}},{{/unless}}{{/each}}{{/if}} + {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: {{requestDataParamFormatter this.name this.type ../requestParameters}}{{#unless @last}},{{/unless}}{{/each}}{{/if}} }, {{/ifCond}} method: 'DELETE', diff --git a/templates/request/get/get.handlebars b/templates/request/get/get.handlebars index 7f49744..7b2950b 100644 --- a/templates/request/get/get.handlebars +++ b/templates/request/get/get.handlebars @@ -10,7 +10,7 @@ {{#ifCond queryParameters queryApiKey}} qs: { {{#if queryApiKey}}{{queryApiKey.type}}: process.env.{{queryApiKey.name}}{{#if queryParameters}}, - {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: 'DATA GOES HERE'{{#unless @last}},{{/unless}}{{/each}}{{/if}} + {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: {{requestDataParamFormatter this.name this.type ../requestParameters}}{{#unless @last}},{{/unless}}{{/each}}{{/if}} }, {{/ifCond}} method: 'GET', diff --git a/templates/request/patch/patch.handlebars b/templates/request/patch/patch.handlebars index ab84edc..0778934 100644 --- a/templates/request/patch/patch.handlebars +++ b/templates/request/patch/patch.handlebars @@ -10,7 +10,7 @@ {{#ifCond queryParameters queryApiKey}} qs: { {{#if queryApiKey}}{{queryApiKey.type}}: process.env.{{queryApiKey.name}}{{#if queryParameters}}, - {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: 'DATA GOES HERE'{{#unless @last}},{{/unless}}{{/each}}{{/if}} + {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: {{requestDataParamFormatter this.name this.type ../requestParameters}}{{#unless @last}},{{/unless}}{{/each}}{{/if}} }, {{/ifCond}} method: 'PATCH', headers: { diff --git a/templates/request/post/post.handlebars b/templates/request/post/post.handlebars index 4308823..aa9d3ff 100644 --- a/templates/request/post/post.handlebars +++ b/templates/request/post/post.handlebars @@ -10,7 +10,7 @@ {{#ifCond queryParameters queryApiKey}} qs: { {{#if queryApiKey}}{{queryApiKey.type}}: process.env.{{queryApiKey.name}}{{#if queryParameters}}, - {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: 'DATA GOES HERE'{{#unless @last}},{{/unless}}{{/each}}{{/if}} + {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: {{requestDataParamFormatter this.name this.type ../requestParameters}}{{#unless @last}},{{/unless}}{{/each}}{{/if}} }, {{/ifCond}} method: 'POST', diff --git a/templates/request/put/put.handlebars b/templates/request/put/put.handlebars index b7645cf..b7551be 100644 --- a/templates/request/put/put.handlebars +++ b/templates/request/put/put.handlebars @@ -10,7 +10,7 @@ {{#ifCond queryParameters queryApiKey}} qs: { {{#if queryApiKey}}{{queryApiKey.type}}: process.env.{{queryApiKey.name}}{{#if queryParameters}}, - {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: 'DATA GOES HERE'{{#unless @last}},{{/unless}}{{/each}}{{/if}} + {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: {{requestDataParamFormatter this.name this.type ../requestParameters}}{{#unless @last}},{{/unless}}{{/each}}{{/if}} }, {{/ifCond}} method: 'PUT', diff --git a/templates/supertest/delete/delete.handlebars b/templates/supertest/delete/delete.handlebars index 6b762e4..33805bc 100644 --- a/templates/supertest/delete/delete.handlebars +++ b/templates/supertest/delete/delete.handlebars @@ -10,7 +10,7 @@ .query({ {{#if queryApiKey}} {{queryApiKey.type}}: process.env.{{queryApiKey.name}}{{#if queryParameters}}, - {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: 'DATA GOES HERE'{{#unless @last}},{{/unless}}{{/each}}{{/if}} + {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: {{requestDataParamFormatter this.name this.type ../requestParameters}}{{#unless @last}},{{/unless}}{{/each}}{{/if}} }) {{/ifCond}} {{#if headerSecurity}} diff --git a/templates/supertest/get/get.handlebars b/templates/supertest/get/get.handlebars index 3e270c8..d462342 100644 --- a/templates/supertest/get/get.handlebars +++ b/templates/supertest/get/get.handlebars @@ -10,7 +10,7 @@ .query({ {{#if queryApiKey}} {{queryApiKey.type}}: process.env.{{queryApiKey.name}}{{#if queryParameters}}, - {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: 'DATA GOES HERE'{{#unless @last}},{{/unless}}{{/each}}{{/if}} + {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: {{requestDataParamFormatter this.name this.type ../requestParameters}}{{#unless @last}},{{/unless}}{{/each}}{{/if}} }) {{/ifCond}} {{#if headerSecurity}} diff --git a/templates/supertest/head/head.handlebars b/templates/supertest/head/head.handlebars index f96633e..64f1cd1 100644 --- a/templates/supertest/head/head.handlebars +++ b/templates/supertest/head/head.handlebars @@ -10,7 +10,7 @@ .query({ {{#if queryApiKey}} {{queryApiKey.type}}: process.env.{{queryApiKey.name}}{{#if queryParameters}}, - {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: 'DATA GOES HERE'{{#unless @last}},{{/unless}}{{/each}}{{/if}} + {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: {{requestDataParamFormatter this.name this.type ../requestParameters}}{{#unless @last}},{{/unless}}{{/each}}{{/if}} }) {{/ifCond}} {{#if headerSecurity}} diff --git a/templates/supertest/options/options.handlebars b/templates/supertest/options/options.handlebars index 91e65fb..cb829d2 100644 --- a/templates/supertest/options/options.handlebars +++ b/templates/supertest/options/options.handlebars @@ -10,7 +10,7 @@ .query({ {{#if queryApiKey}} {{queryApiKey.type}}: process.env.{{queryApiKey.name}}{{#if queryParameters}}, - {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: 'DATA GOES HERE'{{#unless @last}},{{/unless}}{{/each}}{{/if}} + {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: {{requestDataParamFormatter this.name this.type ../requestParameters}}{{#unless @last}},{{/unless}}{{/each}}{{/if}} }) {{/ifCond}} {{#if headerSecurity}} diff --git a/templates/supertest/patch/patch.handlebars b/templates/supertest/patch/patch.handlebars index 24633a1..ec1c5ae 100644 --- a/templates/supertest/patch/patch.handlebars +++ b/templates/supertest/patch/patch.handlebars @@ -10,7 +10,7 @@ .query({ {{#if queryApiKey}} {{queryApiKey.type}}: process.env.{{queryApiKey.name}}{{#if queryParameters}}, - {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: 'DATA GOES HERE'{{#unless @last}},{{/unless}}{{/each}}{{/if}} + {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: {{requestDataParamFormatter this.name this.type ../requestParameters}}{{#unless @last}},{{/unless}}{{/each}}{{/if}} }) {{/ifCond}} {{#if headerSecurity}} diff --git a/templates/supertest/post/post.handlebars b/templates/supertest/post/post.handlebars index fc992e5..32b37bd 100644 --- a/templates/supertest/post/post.handlebars +++ b/templates/supertest/post/post.handlebars @@ -9,7 +9,7 @@ {{#ifCond queryParameters queryApiKey}} .query({ {{#if queryApiKey}}{{queryApiKey.type}}: process.env.{{queryApiKey.name}}{{#if queryParameters}}, - {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: 'DATA GOES HERE'{{#unless @last}},{{/unless}}{{/each}}{{/if}} + {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: {{requestDataParamFormatter this.name this.type ../requestParameters}}{{#unless @last}},{{/unless}}{{/each}}{{/if}} }) {{/ifCond}} {{#if headerSecurity}} diff --git a/templates/supertest/put/put.handlebars b/templates/supertest/put/put.handlebars index 039718b..d04e185 100644 --- a/templates/supertest/put/put.handlebars +++ b/templates/supertest/put/put.handlebars @@ -9,7 +9,7 @@ {{#ifCond queryParameters queryApiKey}} .query({ {{#if queryApiKey}}{{queryApiKey.type}}: process.env.{{queryApiKey.name}}{{#if queryParameters}}, - {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: 'DATA GOES HERE'{{#unless @last}},{{/unless}}{{/each}}{{/if}} + {{/if}}{{/if}}{{#if queryParameters}}{{#each queryParameters}}{{this.name}}: {{requestDataParamFormatter this.name this.type ../requestParameters}}{{#unless @last}},{{/unless}}{{/each}}{{/if}} }) {{/ifCond}} {{#if headerSecurity}} diff --git a/test/request-data/compare/request/expect/qs1-user-test.js b/test/request-data/compare/request/expect/qs1-user-test.js new file mode 100644 index 0000000..8287dde --- /dev/null +++ b/test/request-data/compare/request/expect/qs1-user-test.js @@ -0,0 +1,80 @@ +'use strict'; +var chai = require('chai'); +var request = require('request'); +var expect = chai.expect; + +describe('/user', function() { + describe('post', function() { + it('should respond with 200 OK and some description', function(done) { + request({ + url: 'https://api.uber.com/user', + qs: { + longitude: 10 + }, + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + json: {"my-id":2} + }, + function(error, res, body) { + if (error) return done(error); + + expect(res.statusCode).to.equal(200); + + expect(body).to.equal(null); // non-json response or no schema + done(); + }); + }); + + it('should respond with 400 NOT OK', function(done) { + request({ + url: 'https://api.uber.com/user', + qs: { + longitude: 'DATA GOES HERE' + }, + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + json: { + latitude: 'DATA GOES HERE' + } + }, + function(error, res, body) { + if (error) return done(error); + + expect(res.statusCode).to.equal(400); + + expect(body).to.equal(null); // non-json response or no schema + done(); + }); + }); + + it('should respond with 500 SERVER ERROR', function(done) { + request({ + url: 'https://api.uber.com/user', + qs: { + longitude: 'DATA GOES HERE' + }, + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + json: { + latitude: 'DATA GOES HERE' + } + }, + function(error, res, body) { + if (error) return done(error); + + expect(res.statusCode).to.equal(500); + + expect(body).to.equal(null); // non-json response or no schema + done(); + }); + }); + + }); + +}); diff --git a/test/request-data/compare/request/expect/qs2-user-test.js b/test/request-data/compare/request/expect/qs2-user-test.js new file mode 100644 index 0000000..f2cbc5f --- /dev/null +++ b/test/request-data/compare/request/expect/qs2-user-test.js @@ -0,0 +1,73 @@ +'use strict'; +var chai = require('chai'); +var request = require('request'); +var expect = chai.expect; + +describe('/user', function() { + describe('get', function() { + it('should respond with 200 OK and some description', function(done) { + request({ + url: 'https://api.uber.com/user', + qs: { + longitude: 10 + }, + method: 'GET', + headers: { + 'Content-Type': 'application/json' + } + }, + function(error, res, body) { + if (error) return done(error); + + expect(res.statusCode).to.equal(200); + + expect(body).to.equal(null); // non-json response or no schema + done(); + }); + }); + + it('should respond with 400 NOT OK', function(done) { + request({ + url: 'https://api.uber.com/user', + qs: { + longitude: 'DATA GOES HERE' + }, + method: 'GET', + headers: { + 'Content-Type': 'application/json' + } + }, + function(error, res, body) { + if (error) return done(error); + + expect(res.statusCode).to.equal(400); + + expect(body).to.equal(null); // non-json response or no schema + done(); + }); + }); + + it('should respond with 500 SERVER ERROR', function(done) { + request({ + url: 'https://api.uber.com/user', + qs: { + longitude: 'DATA GOES HERE' + }, + method: 'GET', + headers: { + 'Content-Type': 'application/json' + } + }, + function(error, res, body) { + if (error) return done(error); + + expect(res.statusCode).to.equal(500); + + expect(body).to.equal(null); // non-json response or no schema + done(); + }); + }); + + }); + +}); diff --git a/test/request-data/compare/request/expect/qs3-user-test.js b/test/request-data/compare/request/expect/qs3-user-test.js new file mode 100644 index 0000000..8ba1445 --- /dev/null +++ b/test/request-data/compare/request/expect/qs3-user-test.js @@ -0,0 +1,73 @@ +'use strict'; +var chai = require('chai'); +var request = require('request'); +var expect = chai.expect; + +describe('/user', function() { + describe('get', function() { + it('should respond with 200 OK and some description', function(done) { + request({ + url: 'https://api.uber.com/user', + qs: { + name: 'Simon' + }, + method: 'GET', + headers: { + 'Content-Type': 'application/json' + } + }, + function(error, res, body) { + if (error) return done(error); + + expect(res.statusCode).to.equal(200); + + expect(body).to.equal(null); // non-json response or no schema + done(); + }); + }); + + it('should respond with 400 NOT OK', function(done) { + request({ + url: 'https://api.uber.com/user', + qs: { + name: 'DATA GOES HERE' + }, + method: 'GET', + headers: { + 'Content-Type': 'application/json' + } + }, + function(error, res, body) { + if (error) return done(error); + + expect(res.statusCode).to.equal(400); + + expect(body).to.equal(null); // non-json response or no schema + done(); + }); + }); + + it('should respond with 500 SERVER ERROR', function(done) { + request({ + url: 'https://api.uber.com/user', + qs: { + name: 'DATA GOES HERE' + }, + method: 'GET', + headers: { + 'Content-Type': 'application/json' + } + }, + function(error, res, body) { + if (error) return done(error); + + expect(res.statusCode).to.equal(500); + + expect(body).to.equal(null); // non-json response or no schema + done(); + }); + }); + + }); + +}); diff --git a/test/request-data/swagger-get.json b/test/request-data/swagger-get.json new file mode 100644 index 0000000..311a0a7 --- /dev/null +++ b/test/request-data/swagger-get.json @@ -0,0 +1,38 @@ +{ + "swagger": "2.0", + "info": { + "version": "0.0.0", + "title": "Simple API" + }, + "host": "api.uber.com", + "schemes": [ + "https" + ], + "paths": { + "/user": { + "get": { + "parameters": [ + { + "name": "longitude", + "in": "query", + "description": "longitude component of location.", + "required": true, + "type": "number", + "format": "double" + } + ], + "responses": { + "200": { + "description": "OK" + }, + "400": { + "description": "NOT OK" + }, + "500": { + "description": "SERVER ERROR" + } + } + } + } + } +} diff --git a/test/request-data/swagger-get2.json b/test/request-data/swagger-get2.json new file mode 100644 index 0000000..f9fc3c0 --- /dev/null +++ b/test/request-data/swagger-get2.json @@ -0,0 +1,37 @@ +{ + "swagger": "2.0", + "info": { + "version": "0.0.0", + "title": "Simple API" + }, + "host": "api.uber.com", + "schemes": [ + "https" + ], + "paths": { + "/user": { + "get": { + "parameters": [ + { + "name": "name", + "in": "query", + "description": "name.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK" + }, + "400": { + "description": "NOT OK" + }, + "500": { + "description": "SERVER ERROR" + } + } + } + } + } +} diff --git a/test/request-data/swagger.json b/test/request-data/swagger-post.json similarity index 100% rename from test/request-data/swagger.json rename to test/request-data/swagger-post.json diff --git a/test/request-data/test.js b/test/request-data/test.js index 17e9a02..4edd8b9 100644 --- a/test/request-data/test.js +++ b/test/request-data/test.js @@ -26,7 +26,9 @@ var assert = require('chai').assert; var testGen = require('../../index.js').testGen; -var swagger = require('./swagger.json'); +var swaggerPost = require('./swagger-post.json'); +var swaggerGet = require('./swagger-get.json'); +var swaggerGet2 = require('./swagger-get2.json'); var yaml = require('js-yaml'); var join = require('path').join; var rules; @@ -36,17 +38,102 @@ rules = yaml.safeLoad(read(join(__dirname, '/../../.eslintrc'), 'utf8')); rules.env = {mocha: true}; describe('request data population', function() { - describe('with descriptipn', function() { + describe('with request body', function() { + describe('with description', function() { + describe('expect', function() { + var output1 = testGen(swaggerPost, { + assertionFormat: 'expect', + pathName: [], + testModule: 'request', + maxLen: -1, + requestData: { + '/user': { + post: { + 200: [{body: {"my-id": 2}, description: 'some description'}] + } + } + } + }); + + var paths1 = []; + var ndx; + + for (ndx in output1) { + if (output1) { + paths1.push(join(__dirname, '/compare/request/expect/' + output1[ndx].name)); + } + } + + it('should have a extended description and test data in the json request', function() { + + assert.isArray(output1); + assert.lengthOf(output1, 1); + + var generatedCode; + + for (ndx in paths1) { + if (paths1 !== undefined) { + generatedCode = read(paths1[ndx], 'utf8').replace(/\r\n/g, '\n'); + assert.equal(output1[ndx].test.replace(/\r\n/g, '\n'), generatedCode); + } + } + }); + }); + }); + + describe('and query string', function() { + describe('expect', function() { + var output2 = testGen(swaggerPost, { + assertionFormat: 'expect', + pathName: [], + testModule: 'request', + maxLen: -1, + requestData: { + '/user': { + post: { + 200: [{body: {"my-id": 2}, longitude: 10, description: 'some description'}] + } + } + } + }); + + var paths1 = []; + var ndx; + + for (ndx in output2) { + if (output2) { + paths1.push(join(__dirname, '/compare/request/expect/qs1-' + output2[ndx].name)); + } + } + + it('should populate query parameters in test description', function() { + assert.isArray(output2); + assert.lengthOf(output2, 1); + + var generatedCode; + + for (ndx in paths1) { + if (paths1 !== undefined) { + generatedCode = read(paths1[ndx], 'utf8').replace(/\r\n/g, '\n'); + assert.equal(output2[ndx].test.replace(/\r\n/g, '\n'), generatedCode); + } + } + }); + }); + }); + }); + + describe('with query string', function() { describe('expect', function() { - var output1 = testGen(swagger, { + var output3 = testGen(swaggerGet, { assertionFormat: 'expect', pathName: [], testModule: 'request', maxLen: -1, requestData: { '/user': { - post: { - 200: [{body: {"my-id": 2}, description: 'some description'}] + get: { + 200: [{longitude: 10, description: 'some description'}] } } } @@ -55,25 +142,65 @@ describe('request data population', function() { var paths1 = []; var ndx; - for (ndx in output1) { - if (output1) { - paths1.push(join(__dirname, '/compare/request/expect/' + output1[ndx].name)); + for (ndx in output3) { + if (output3) { + paths1.push(join(__dirname, '/compare/request/expect/qs2-' + output3[ndx].name)); } } - it('should have a extended description and test data in the json request', function() { - - assert.isArray(output1); - assert.lengthOf(output1, 1); + it('should populate query parameters in test description', function() { + assert.isArray(output3); + assert.lengthOf(output3, 1); var generatedCode; for (ndx in paths1) { if (paths1 !== undefined) { generatedCode = read(paths1[ndx], 'utf8').replace(/\r\n/g, '\n'); - assert.equal(output1[ndx].test.replace(/\r\n/g, '\n'), generatedCode); + assert.equal(output3[ndx].test.replace(/\r\n/g, '\n'), generatedCode); + } + } + }); + }); + + describe('with string parameter', function() { + describe('expect', function() { + var output4 = testGen(swaggerGet2, { + assertionFormat: 'expect', + pathName: [], + testModule: 'request', + maxLen: -1, + requestData: { + '/user': { + get: { + 200: [{name: 'Simon', description: 'some description'}] + } + } + } + }); + + var paths1 = []; + var ndx; + + for (ndx in output4) { + if (output4) { + paths1.push(join(__dirname, '/compare/request/expect/qs3-' + output4[ndx].name)); } } + + it('should populate query parameters in test description', function() { + assert.isArray(output4); + assert.lengthOf(output4, 1); + + var generatedCode; + + for (ndx in paths1) { + if (paths1 !== undefined) { + generatedCode = read(paths1[ndx], 'utf8').replace(/\r\n/g, '\n'); + assert.equal(output4[ndx].test.replace(/\r\n/g, '\n'), generatedCode); + } + } + }); }); }); });