diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-21 09:06:16 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-21 09:06:16 +0000 |
commit | a048261403ea7e12992ccffe704f0779235712d7 (patch) | |
tree | 59254549db6d39a4da824379a7bf354e7c8e7e67 /spec/frontend/lib/utils/url_utility_spec.js | |
parent | 80e5134020483299c039114e76b734436f006c66 (diff) | |
download | gitlab-ce-a048261403ea7e12992ccffe704f0779235712d7.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/lib/utils/url_utility_spec.js')
-rw-r--r-- | spec/frontend/lib/utils/url_utility_spec.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/frontend/lib/utils/url_utility_spec.js b/spec/frontend/lib/utils/url_utility_spec.js index 6edb2e2dce2..8244acbceea 100644 --- a/spec/frontend/lib/utils/url_utility_spec.js +++ b/spec/frontend/lib/utils/url_utility_spec.js @@ -282,4 +282,20 @@ describe('URL utility', () => { expect(urlUtils.getWebSocketUrl(path)).toEqual('ws://example.com/lorem/ipsum?a=bc'); }); }); + + describe('queryToObject', () => { + it('converts search query into an object', () => { + const searchQuery = '?one=1&two=2'; + + expect(urlUtils.queryToObject(searchQuery)).toEqual({ one: '1', two: '2' }); + }); + }); + + describe('objectToQuery', () => { + it('converts search query object back into a search query', () => { + const searchQueryObject = { one: '1', two: '2' }; + + expect(urlUtils.objectToQuery(searchQueryObject)).toEqual('one=1&two=2'); + }); + }); }); |