Skip to content

Commit 4a01589

Browse files
committed
Fixed skipped tests
1 parent c19a6bd commit 4a01589

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

test/unit/convertV2.test.js

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@ describe('The convert v2 Function', function() {
179179
});
180180
});
181181

182-
// @todo: check the order. Also add unique constraint while pushing in the collection variables
183-
it.skip(' Fix for GITHUB#133: Should generate collection with proper Path and Collection variables', function(done) {
182+
it(' Fix for GITHUB#133: Should generate collection with proper Path and Collection variables', function(done) {
184183
var openapi = fs.readFileSync(issue133, 'utf8');
185184
Converter.convertV2({ type: 'string', data: openapi },
186185
{ parametersResolution: 'Example', schemaFaker: true }, (err, conversionResult) => {
@@ -193,15 +192,15 @@ describe('The convert v2 Function', function() {
193192
expect(conversionResult.output[0].data).to.have.property('item');
194193
expect(conversionResult.output[0].data).to.have.property('variable');
195194
expect(conversionResult.output[0].data.variable).to.be.an('array');
196-
expect(conversionResult.output[0].data.variable[1].key).to.equal('format');
197-
expect(conversionResult.output[0].data.variable[1].value).to.equal('json');
198-
expect(conversionResult.output[0].data.variable[2].key).to.equal('path');
199-
expect(conversionResult.output[0].data.variable[2].value).to.equal('send-email');
200-
expect(conversionResult.output[0].data.variable[3].key).to.equal('new-path-variable-1');
195+
expect(conversionResult.output[0].data.variable[4].key).to.equal('format');
196+
expect(conversionResult.output[0].data.variable[4].value).to.equal('json');
197+
expect(conversionResult.output[0].data.variable[5].key).to.equal('path');
198+
expect(conversionResult.output[0].data.variable[5].value).to.equal('send-email');
199+
expect(conversionResult.output[0].data.variable[6].key).to.equal('new-path-variable-1');
201200
// serialised value for object { R: 100, G: 200, B: 150 }
202-
expect(conversionResult.output[0].data.variable[3].value).to.equal('R,100,G,200,B,150');
203-
expect(conversionResult.output[0].data.variable[4].key).to.equal('new-path-variable-2');
204-
expect(conversionResult.output[0].data.variable[4].value).to.contain('exampleString');
201+
expect(conversionResult.output[0].data.variable[6].value).to.equal('R,100,G,200,B,150');
202+
expect(conversionResult.output[0].data.variable[7].key).to.equal('new-path-variable-2');
203+
expect(conversionResult.output[0].data.variable[7].value).to.contain('exampleString');
205204
done();
206205
});
207206
});
@@ -334,13 +333,13 @@ describe('The convert v2 Function', function() {
334333
});
335334

336335
// Need to handle xml body properly
337-
it.skip('convertor should add custom header in the response' +
336+
it('convertor should add custom header in the response' +
338337
customHeadersSpec, function(done) {
339338
var openapi = fs.readFileSync(customHeadersSpec, 'utf8');
340339
Converter.convertV2({ type: 'string', data: openapi }, { schemaFaker: true }, (err, conversionResult) => {
341340
expect(err).to.be.null;
342-
expect(conversionResult.output[0].data.item[0].response[0].header[0].value)
343-
.to.equal('application/vnd.retailer.v3+json');
341+
expect(conversionResult.output[0].data.item[0].item[0].item[0].response[0].header[0].value)
342+
.to.equal('application/vnd.retailer.v3+xml');
344343
done();
345344
});
346345
});
@@ -770,13 +769,13 @@ describe('The convert v2 Function', function() {
770769
});
771770

772771
// Confirm behaviour for `schema` resolution
773-
it.skip('should convert to the expected schema with use of schemaFaker and schemaResolution caches', function(done) {
772+
it('should convert to the expected schema with use of schemaFaker and schemaResolution caches', function(done) {
774773
Converter.convertV2({ type: 'file', data: multipleRefs }, {}, (err, conversionResult) => {
775774
expect(err).to.be.null;
776775
expect(conversionResult.result).to.equal(true);
777-
let items = conversionResult.output[0].data.item,
778-
request = items[0].request,
779-
response = items[0].response,
776+
let item = conversionResult.output[0].data.item[0].item[0],
777+
request = item.request,
778+
response = item.response,
780779
requestBody = JSON.parse(request.body.raw),
781780
responseBody = JSON.parse(response[0].body);
782781
expect(requestBody).to.deep.equal({
@@ -791,12 +790,12 @@ describe('The convert v2 Function', function() {
791790
});
792791
expect(responseBody).to.deep.equal({
793792
key1: {
794-
responseId: 234,
795-
responseName: '200 OK Response'
793+
responseId: '<long>',
794+
responseName: '<string>'
796795
},
797796
key2: {
798-
responseId: 234,
799-
responseName: '200 OK Response'
797+
responseId: '<long>',
798+
responseName: '<string>'
800799
}
801800
});
802801
done();

0 commit comments

Comments
 (0)