2018-12-17 17:38:05 +00:00
|
|
|
const createSearch = require('../createSearch');
|
2018-05-26 00:22:59 +00:00
|
|
|
|
2018-12-17 17:38:05 +00:00
|
|
|
describe('createSearch', () => {
|
|
|
|
it('omits the trailing = for empty string values', () => {
|
|
|
|
expect(createSearch({ a: 'a', b: '' })).toEqual('?a=a&b');
|
2018-05-26 00:22:59 +00:00
|
|
|
});
|
|
|
|
|
2018-12-17 17:38:05 +00:00
|
|
|
it('sorts keys', () => {
|
|
|
|
expect(createSearch({ b: 'b', a: 'a', c: 'c' })).toEqual('?a=a&b=b&c=c');
|
2018-05-26 00:22:59 +00:00
|
|
|
});
|
|
|
|
|
2018-12-17 17:38:05 +00:00
|
|
|
it('returns an empty string when there are no params', () => {
|
|
|
|
expect(createSearch({})).toEqual('');
|
2018-05-26 00:22:59 +00:00
|
|
|
});
|
|
|
|
});
|