File tree Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,63 @@ describe('execute', () => {
188188 } )
189189 } )
190190
191+ it ( 'should include values and defaults that are falsy' , function ( ) {
192+ // Given
193+ const spec = {
194+ host : 'swagger.io' ,
195+ basePath : '/v1' ,
196+ paths : {
197+ '/one' : {
198+ get : {
199+ operationId : 'getMe' ,
200+ parameters : [
201+ {
202+ name : 'zero' ,
203+ in : 'query' ,
204+ type : 'integer'
205+ } ,
206+ {
207+ name : 'false' ,
208+ in : 'query' ,
209+ type : 'boolean'
210+ } ,
211+ {
212+ name : 'zeroDefault' ,
213+ in : 'query' ,
214+ type : 'integer' ,
215+ default : 0
216+ } ,
217+ {
218+ name : 'falseDefault' ,
219+ in : 'query' ,
220+ type : 'boolean' ,
221+ default : false
222+ } ,
223+ ]
224+ }
225+ }
226+ }
227+ }
228+
229+ // When
230+ const req = buildRequest ( {
231+ spec,
232+ operationId : 'getMe' ,
233+ parameters : {
234+ false : false ,
235+ zero : 0
236+ }
237+ } )
238+
239+ // Then
240+ expect ( req ) . toEqual ( {
241+ url : 'http://swagger.io/v1/one?zero=0&false=false&zeroDefault=0&falseDefault=false' ,
242+ method : 'GET' ,
243+ credentials : 'same-origin' ,
244+ headers : { }
245+ } )
246+ } )
247+
191248 it ( 'should include values for boolean query parameters' , function ( ) {
192249 // Given
193250 const spec = {
You can’t perform that action at this time.
0 commit comments