summaryrefslogtreecommitdiff
path: root/spec/frontend/lib/utils/url_utility_spec.js
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-21 09:06:16 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-21 09:06:16 +0000
commita048261403ea7e12992ccffe704f0779235712d7 (patch)
tree59254549db6d39a4da824379a7bf354e7c8e7e67 /spec/frontend/lib/utils/url_utility_spec.js
parent80e5134020483299c039114e76b734436f006c66 (diff)
downloadgitlab-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.js16
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');
+ });
+ });
});