diff options
Diffstat (limited to 'spec/frontend/lib/utils/url_utility_spec.js')
-rw-r--r-- | spec/frontend/lib/utils/url_utility_spec.js | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/spec/frontend/lib/utils/url_utility_spec.js b/spec/frontend/lib/utils/url_utility_spec.js index a625c9cd274..048736d75f6 100644 --- a/spec/frontend/lib/utils/url_utility_spec.js +++ b/spec/frontend/lib/utils/url_utility_spec.js @@ -330,46 +330,46 @@ describe('URL utility', () => { expect(urlUtils.escapeFileUrl('foo/bar/file.md')).toBe('foo/bar/file.md'); }); }); -}); -describe('setUrlParams', () => { - it('adds new params as query string', () => { - const url = 'https://gitlab.com/test'; + describe('setUrlParams', () => { + it('adds new params as query string', () => { + const url = 'https://gitlab.com/test'; - expect( - urlUtils.setUrlParams({ group_id: 'gitlab-org', project_id: 'my-project' }, url), - ).toEqual('https://gitlab.com/test?group_id=gitlab-org&project_id=my-project'); - }); + expect( + urlUtils.setUrlParams({ group_id: 'gitlab-org', project_id: 'my-project' }, url), + ).toEqual('https://gitlab.com/test?group_id=gitlab-org&project_id=my-project'); + }); - it('updates an existing parameter', () => { - const url = 'https://gitlab.com/test?group_id=gitlab-org&project_id=my-project'; + it('updates an existing parameter', () => { + const url = 'https://gitlab.com/test?group_id=gitlab-org&project_id=my-project'; - expect(urlUtils.setUrlParams({ project_id: 'gitlab-test' }, url)).toEqual( - 'https://gitlab.com/test?group_id=gitlab-org&project_id=gitlab-test', - ); - }); + expect(urlUtils.setUrlParams({ project_id: 'gitlab-test' }, url)).toEqual( + 'https://gitlab.com/test?group_id=gitlab-org&project_id=gitlab-test', + ); + }); - it("removes the project_id param when it's value is null", () => { - const url = 'https://gitlab.com/test?group_id=gitlab-org&project_id=my-project'; + it("removes the project_id param when it's value is null", () => { + const url = 'https://gitlab.com/test?group_id=gitlab-org&project_id=my-project'; - expect(urlUtils.setUrlParams({ project_id: null }, url)).toEqual( - 'https://gitlab.com/test?group_id=gitlab-org', - ); - }); + expect(urlUtils.setUrlParams({ project_id: null }, url)).toEqual( + 'https://gitlab.com/test?group_id=gitlab-org', + ); + }); - it('handles arrays properly', () => { - const url = 'https://gitlab.com/test'; + it('handles arrays properly', () => { + const url = 'https://gitlab.com/test'; - expect(urlUtils.setUrlParams({ label_name: ['foo', 'bar'] }, url)).toEqual( - 'https://gitlab.com/test?label_name=foo&label_name=bar', - ); - }); + expect(urlUtils.setUrlParams({ label_name: ['foo', 'bar'] }, url)).toEqual( + 'https://gitlab.com/test?label_name=foo&label_name=bar', + ); + }); - it('removes all existing URL params and sets a new param when cleanParams=true', () => { - const url = 'https://gitlab.com/test?group_id=gitlab-org&project_id=my-project'; + it('removes all existing URL params and sets a new param when cleanParams=true', () => { + const url = 'https://gitlab.com/test?group_id=gitlab-org&project_id=my-project'; - expect(urlUtils.setUrlParams({ foo: 'bar' }, url, true)).toEqual( - 'https://gitlab.com/test?foo=bar', - ); + expect(urlUtils.setUrlParams({ foo: 'bar' }, url, true)).toEqual( + 'https://gitlab.com/test?foo=bar', + ); + }); }); }); |