@@ -132,8 +132,7 @@ describe('The convert v2 Function', function() {
132
132
133
133
it ( 'Should generate collection conforming to schema for and fail if not valid ' +
134
134
tooManyRefs , function ( done ) {
135
- var openapi = fs . readFileSync ( tooManyRefs , 'utf8' ) ,
136
- body ;
135
+ var openapi = fs . readFileSync ( tooManyRefs , 'utf8' ) ;
137
136
Converter . convertV2 ( { type : 'string' , data : openapi } , { schemaFaker : true } , ( err , conversionResult ) => {
138
137
139
138
expect ( err ) . to . be . null ;
@@ -142,7 +141,8 @@ describe('The convert v2 Function', function() {
142
141
expect ( conversionResult . output [ 0 ] . type ) . to . equal ( 'collection' ) ;
143
142
expect ( conversionResult . output [ 0 ] . data ) . to . have . property ( 'info' ) ;
144
143
expect ( conversionResult . output [ 0 ] . data ) . to . have . property ( 'item' ) ;
145
- body = conversionResult . output [ 0 ] . data . item [ 1 ] . response [ 0 ] . body ;
144
+ let body = conversionResult . output [ 0 ] . data . item [ 1 ] . response [ 0 ] . body ;
145
+
146
146
expect ( body ) . to . contain ( '<Error: Too many levels of nesting to fake this schema>' ) ;
147
147
done ( ) ;
148
148
} ) ;
@@ -1807,21 +1807,22 @@ describe('The convert v2 Function', function() {
1807
1807
// Make sure that path params are updated and their respective default values
1808
1808
convertResult . output . forEach ( function ( element ) {
1809
1809
expect ( element . type ) . to . equal ( 'collection' ) ;
1810
- expect ( element . data . item [ 0 ] . item [ 0 ] . item [ 0 ]
1810
+ expect ( element . data . item [ 0 ] . item [ 0 ]
1811
1811
. item [ 0 ] . item [ 0 ] . request . url . path . indexOf ( ':ownerId' ) > - 1 )
1812
1812
. to . equal ( true ) ;
1813
- expect ( element . data . item [ 0 ] . item [ 0 ] . item [ 0 ]
1813
+ expect ( element . data . item [ 0 ] . item [ 0 ]
1814
1814
. item [ 0 ] . item [ 0 ] . request . url . path . indexOf ( ':petId' ) > - 1 )
1815
1815
. to . equal ( true ) ;
1816
1816
1817
- let thisVar = element . data . item [ 0 ] . item [ 0 ] . item [ 0 ] . item [ 0 ] . item [ 0 ] . request . url . variable [ 0 ] ;
1817
+ let thisVar = element . data . item [ 0 ] . item [ 0 ] . item [ 0 ] . item [ 0 ] . request . url . variable [ 0 ] ;
1818
1818
1819
1819
expect ( thisVar . type ) . to . equal ( 'any' ) ;
1820
1820
1821
1821
expect ( thisVar . value ) . to . equal ( '42' ) ;
1822
1822
expect ( thisVar . key ) . to . equal ( 'ownerId' ) ;
1823
+
1824
+ done ( ) ;
1823
1825
} ) ;
1824
- done ( ) ;
1825
1826
} ) ;
1826
1827
} ) ;
1827
1828
@@ -1926,16 +1927,16 @@ describe('The convert v2 Function', function() {
1926
1927
optimizeConversion : false , stackLimit : 50
1927
1928
} , ( err , result ) => {
1928
1929
const expectedResponseBody1 = JSON . parse (
1929
- result . output [ 0 ] . data . item [ 0 ] . item [ 0 ] . item [ 0 ] . item [ 0 ]
1930
+ result . output [ 0 ] . data . item [ 0 ] . item [ 0 ]
1930
1931
. item [ 0 ] . response [ 0 ] . body
1931
1932
) ,
1932
1933
expectedResponseBody2 = JSON . parse (
1933
1934
result . output [ 0 ] . data . item [ 0 ] . item [ 0 ] . item [ 1 ] . item [ 0 ] . response [ 0 ] . body
1934
1935
) ;
1935
1936
expect ( err ) . to . be . null ;
1936
1937
expect ( result . result ) . to . be . true ;
1937
- expect ( expectedResponseBody1 . payload ) . to . be . eql ( '<boolean>' ) ;
1938
- expect ( expectedResponseBody2 . payload ) . to . be . an ( 'object' )
1938
+ expect ( expectedResponseBody2 . payload ) . to . be . eql ( '<boolean>' ) ;
1939
+ expect ( expectedResponseBody1 . payload ) . to . be . an ( 'object' )
1939
1940
. and . to . have . all . keys ( 'content' , 'paging' ) ;
1940
1941
} ) ;
1941
1942
} ) ;
@@ -1948,7 +1949,7 @@ describe('The convert v2 Function', function() {
1948
1949
expect ( err ) . to . be . null ;
1949
1950
expect ( conversionResult . result ) . to . equal ( true ) ;
1950
1951
1951
- const response = conversionResult . output [ 0 ] . data . item [ 0 ] . item [ 0 ] . item [ 0 ] . response [ 0 ] ;
1952
+ const response = conversionResult . output [ 0 ] . data . item [ 0 ] . item [ 0 ] . response [ 0 ] ;
1952
1953
expect ( response . body ) . to . equal ( '[\n\t{\n\t\t"id": "<long>",\n\t\t"name": "<string>",\n\t\t"tag": "<string>"' +
1953
1954
'\n\t},\n\t{\n\t\t"id": "<long>",\n\t\t"name": "<string>",\n\t\t"tag": "<string>"' +
1954
1955
'\n\t}\n]' ) ;
@@ -1963,7 +1964,7 @@ describe('The convert v2 Function', function() {
1963
1964
expect ( err ) . to . be . null ;
1964
1965
expect ( conversionResult . result ) . to . equal ( true ) ;
1965
1966
1966
- const response = conversionResult . output [ 0 ] . data . item [ 0 ] . item [ 0 ] . item [ 0 ] . response [ 0 ] ;
1967
+ const response = conversionResult . output [ 0 ] . data . item [ 0 ] . item [ 0 ] . response [ 0 ] ;
1967
1968
expect ( response . body ) . to . equal ( '[\n {\n "id": "<long>",\n "name": "<string>",\n "tag": "<string>' +
1968
1969
'"\n },\n {\n "id": "<long>",\n "name": "<string>",\n "tag": "<string>"\n }\n]' ) ;
1969
1970
done ( ) ;
@@ -1984,7 +1985,7 @@ describe('The convert v2 Function', function() {
1984
1985
expect ( conversionResult . output [ 0 ] . data . auth . apikey [ 0 ] . value ) . to . equal ( '{{apiKeyName}}' ) ;
1985
1986
expect ( conversionResult . output [ 0 ] . data . auth . apikey [ 1 ] . value ) . to . equal ( '{{apiKey}}' ) ;
1986
1987
1987
- const item = conversionResult . output [ 0 ] . data . item [ 0 ] . item [ 0 ] . item [ 0 ] ;
1988
+ const item = conversionResult . output [ 0 ] . data . item [ 0 ] . item [ 0 ] ;
1988
1989
expect ( item . request . header ) . to . not . be . ok ;
1989
1990
expect ( item . response [ 0 ] . originalRequest . header [ 0 ] ) . to . be . eql ( {
1990
1991
description : {
@@ -2006,7 +2007,7 @@ describe('The convert v2 Function', function() {
2006
2007
expect ( err ) . to . be . null ;
2007
2008
expect ( conversionResult . result ) . to . equal ( true ) ;
2008
2009
2009
- const item = conversionResult . output [ 0 ] . data . item [ 0 ] . item [ 0 ] . item [ 0 ] ;
2010
+ const item = conversionResult . output [ 0 ] . data . item [ 0 ] . item [ 0 ] ;
2010
2011
expect ( item . request . header ) . to . not . be . ok ;
2011
2012
expect ( item . response [ 0 ] . originalRequest . header ) . to . not . be . ok ;
2012
2013
@@ -2028,7 +2029,7 @@ describe('The convert v2 Function', function() {
2028
2029
expect ( conversionResult . output [ 0 ] . data . auth . oauth1 [ 0 ] . value ) . to . equal ( '{{consumerSecret}}' ) ;
2029
2030
expect ( conversionResult . output [ 0 ] . data . auth . oauth1 [ 1 ] . value ) . to . equal ( '{{consumerKey}}' ) ;
2030
2031
2031
- const item = conversionResult . output [ 0 ] . data . item [ 0 ] . item [ 0 ] . item [ 0 ] ;
2032
+ const item = conversionResult . output [ 0 ] . data . item [ 0 ] . item [ 0 ] ;
2032
2033
2033
2034
expect ( item . request . header ) . to . not . be . ok ;
2034
2035
expect ( item . response [ 0 ] . originalRequest . header [ 0 ] ) . to . be . eql ( {
0 commit comments