Skip to content

Commit

Permalink
URL: Test undefined values as ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Nov 6, 2018
1 parent e024015 commit 50b5c18
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/url/src/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ describe( 'addQueryArgs', () => {

expect( safeDecodeURI( addQueryArgs( url, args ) ) ).toBe( 'https://andalouses.example/beach?time[0]=10&time[1]=11&beach[0]=sand&beach[1]=rock' );
} );

it( 'should disregard keys with undefined values', () => {
const url = 'https://andalouses.example/beach';
const args = { sun: 'true', sand: undefined };

expect( addQueryArgs( url, args ) ).toBe( 'https://andalouses.example/beach?sun=true' );
} );
} );

describe( 'getQueryArg', () => {
Expand Down

0 comments on commit 50b5c18

Please sign in to comment.