Skip to content

Commit

Permalink
Add test for making sure addQueryArgs updates existing arguments.
Browse files Browse the repository at this point in the history
This is to ensure it will not leave duplicate arguments behind.
  • Loading branch information
schlessera committed Aug 15, 2017
1 parent 0ae3bd3 commit ac44be3
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 @@ -17,4 +17,11 @@ describe( 'addQueryArgs', () => {

expect( addQueryArgs( url, args ) ).toBe( 'https://andalouses.com/beach?night=false&sun=true&sand=false' );
} );

test( 'should update args to an URL with conflicting query string', () => {
const url = 'https://andalouses.com/beach?night=false&sun=false&sand=true';
const args = { sun: 'true', sand: 'false' };

expect( addQueryArgs( url, args ) ).toBe( 'https://andalouses.com/beach?night=false&sun=true&sand=false' );
} );
} );

0 comments on commit ac44be3

Please sign in to comment.