Commit c4d4f4d8 authored by Filipa Lacerda's avatar Filipa Lacerda

Clean history after every test that changes history

parent 20b54b13
...@@ -91,6 +91,10 @@ describe('Environment', () => { ...@@ -91,6 +91,10 @@ describe('Environment', () => {
}); });
describe('pagination', () => { describe('pagination', () => {
afterEach(() => {
window.history.pushState({}, null, '');
});
it('should render pagination', (done) => { it('should render pagination', (done) => {
setTimeout(() => { setTimeout(() => {
expect( expect(
......
...@@ -46,6 +46,10 @@ require('~/lib/utils/common_utils'); ...@@ -46,6 +46,10 @@ require('~/lib/utils/common_utils');
spyOn(window.document, 'getElementById').and.callThrough(); spyOn(window.document, 'getElementById').and.callThrough();
}); });
afterEach(() => {
window.history.pushState({}, null, '');
});
function expectGetElementIdToHaveBeenCalledWith(elementId) { function expectGetElementIdToHaveBeenCalledWith(elementId) {
expect(window.document.getElementById).toHaveBeenCalledWith(elementId); expect(window.document.getElementById).toHaveBeenCalledWith(elementId);
} }
...@@ -80,6 +84,10 @@ require('~/lib/utils/common_utils'); ...@@ -80,6 +84,10 @@ require('~/lib/utils/common_utils');
window.history.pushState({}, null, '?scope=all&p=2'); window.history.pushState({}, null, '?scope=all&p=2');
}); });
afterEach(() => {
window.history.pushState({}, null, '');
});
it('should return valid parameter', () => { it('should return valid parameter', () => {
const value = gl.utils.getParameterByName('scope'); const value = gl.utils.getParameterByName('scope');
expect(value).toBe('all'); expect(value).toBe('all');
......
...@@ -124,6 +124,10 @@ describe('Pagination component', () => { ...@@ -124,6 +124,10 @@ describe('Pagination component', () => {
}); });
describe('paramHelper', () => { describe('paramHelper', () => {
afterEach(() => {
window.history.pushState({}, null, '');
});
it('can parse url parameters correctly', () => { it('can parse url parameters correctly', () => {
window.history.pushState({}, null, '?scope=all&p=2'); window.history.pushState({}, null, '?scope=all&p=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