Commit 552953c9 authored by Regis's avatar Regis

add paramHelper tests

parent e98cdf4b
......@@ -142,3 +142,25 @@ describe('Pagination component', () => {
expect(changeChanges.two).toEqual('all');
});
});
describe('paramHelper', () => {
it('can parse url parameters correctly', () => {
window.history.pushState({}, null, '?scope=all&p=2');
const scope = gl.getParameterByName('scope');
const p = gl.getParameterByName('p');
expect(scope).toEqual('all');
expect(p).toEqual('2');
});
it('returns null if param not in url', () => {
window.history.pushState({}, null, '?p=2');
const scope = gl.getParameterByName('scope');
const p = gl.getParameterByName('p');
expect(scope).toEqual(null);
expect(p).toEqual('2');
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment