Skip to content

Commit

Permalink
Add a test for stringified searchParams in merge (#1208)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaulz committed May 10, 2020
1 parent 91aa0ac commit 7d7361c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/normalize-arguments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ test('should merge options replacing responseType', t => {
t.is(options.responseType, responseType);
});

test('no duplicated searchParams values', t => {
const options = got.mergeOptions(got.defaults.options, {
searchParams: 'string=true&noDuplication=true'
}, {
searchParams: new URLSearchParams({
instance: 'true',
noDuplication: 'true'
})
});

t.is(options.searchParams?.get('string'), 'true');
t.is(options.searchParams?.get('instance'), 'true');
t.is(options.searchParams?.getAll('noDuplication').length, 1);
});

test('should copy non-numerable properties', t => {
const options = {
json: {hello: '123'}
Expand Down

0 comments on commit 7d7361c

Please sign in to comment.