@@ -179,8 +179,7 @@ describe('The convert v2 Function', function() {
179
179
} ) ;
180
180
} ) ;
181
181
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 ) {
184
183
var openapi = fs . readFileSync ( issue133 , 'utf8' ) ;
185
184
Converter . convertV2 ( { type : 'string' , data : openapi } ,
186
185
{ parametersResolution : 'Example' , schemaFaker : true } , ( err , conversionResult ) => {
@@ -193,15 +192,15 @@ describe('The convert v2 Function', function() {
193
192
expect ( conversionResult . output [ 0 ] . data ) . to . have . property ( 'item' ) ;
194
193
expect ( conversionResult . output [ 0 ] . data ) . to . have . property ( 'variable' ) ;
195
194
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' ) ;
201
200
// 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' ) ;
205
204
done ( ) ;
206
205
} ) ;
207
206
} ) ;
@@ -334,13 +333,13 @@ describe('The convert v2 Function', function() {
334
333
} ) ;
335
334
336
335
// 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' +
338
337
customHeadersSpec , function ( done ) {
339
338
var openapi = fs . readFileSync ( customHeadersSpec , 'utf8' ) ;
340
339
Converter . convertV2 ( { type : 'string' , data : openapi } , { schemaFaker : true } , ( err , conversionResult ) => {
341
340
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 ' ) ;
344
343
done ( ) ;
345
344
} ) ;
346
345
} ) ;
@@ -770,13 +769,13 @@ describe('The convert v2 Function', function() {
770
769
} ) ;
771
770
772
771
// 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 ) {
774
773
Converter . convertV2 ( { type : 'file' , data : multipleRefs } , { } , ( err , conversionResult ) => {
775
774
expect ( err ) . to . be . null ;
776
775
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 ,
780
779
requestBody = JSON . parse ( request . body . raw ) ,
781
780
responseBody = JSON . parse ( response [ 0 ] . body ) ;
782
781
expect ( requestBody ) . to . deep . equal ( {
@@ -791,12 +790,12 @@ describe('The convert v2 Function', function() {
791
790
} ) ;
792
791
expect ( responseBody ) . to . deep . equal ( {
793
792
key1 : {
794
- responseId : 234 ,
795
- responseName : '200 OK Response '
793
+ responseId : '<long>' ,
794
+ responseName : '<string> '
796
795
} ,
797
796
key2 : {
798
- responseId : 234 ,
799
- responseName : '200 OK Response '
797
+ responseId : '<long>' ,
798
+ responseName : '<string> '
800
799
}
801
800
} ) ;
802
801
done ( ) ;
0 commit comments