summaryrefslogtreecommitdiff
path: root/spec/javascripts/lib/utils/common_utils_spec.js.es6
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-01-13 10:30:40 -0500
committerPhil Hughes <me@iamphill.com>2017-01-13 10:30:40 -0500
commit639bca436297e65f16499c5b76a9e5ffb2b798c8 (patch)
tree832636f41824529da2796dedc7888effd42940c9 /spec/javascripts/lib/utils/common_utils_spec.js.es6
parentbdcb81be95b3287e14cf23b2f1d0849b24077360 (diff)
parent4b43126d08972c201551fbd1fe42e85847d5e03f (diff)
downloadgitlab-ce-639bca436297e65f16499c5b76a9e5ffb2b798c8.tar.gz
Merge branch 'master' into go-go-gadget-webpack
Diffstat (limited to 'spec/javascripts/lib/utils/common_utils_spec.js.es6')
-rw-r--r--spec/javascripts/lib/utils/common_utils_spec.js.es624
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/javascripts/lib/utils/common_utils_spec.js.es6 b/spec/javascripts/lib/utils/common_utils_spec.js.es6
index e33360a1875..a54bb9bb444 100644
--- a/spec/javascripts/lib/utils/common_utils_spec.js.es6
+++ b/spec/javascripts/lib/utils/common_utils_spec.js.es6
@@ -15,6 +15,7 @@ require('~/lib/utils/common_utils');
expect(gl.utils.parseUrl('" test="asf"').pathname).toEqual('/%22%20test=%22asf%22');
});
});
+
describe('gl.utils.parseUrlPathname', () => {
beforeEach(() => {
spyOn(gl.utils, 'parseUrl').and.callFake(url => ({
@@ -28,5 +29,28 @@ require('~/lib/utils/common_utils');
expect(gl.utils.parseUrlPathname('some/relative/url')).toEqual('/some/relative/url');
});
});
+
+ describe('gl.utils.getUrlParamsArray', () => {
+ it('should return params array', () => {
+ expect(gl.utils.getUrlParamsArray() instanceof Array).toBe(true);
+ });
+
+ it('should remove the question mark from the search params', () => {
+ const paramsArray = gl.utils.getUrlParamsArray();
+ expect(paramsArray[0][0] !== '?').toBe(true);
+ });
+ });
+
+ describe('gl.utils.getParameterByName', () => {
+ it('should return valid parameter', () => {
+ const value = gl.utils.getParameterByName('reporter');
+ expect(value).toBe('Console');
+ });
+
+ it('should return invalid parameter', () => {
+ const value = gl.utils.getParameterByName('fakeParameter');
+ expect(value).toBe(null);
+ });
+ });
});
})();