Commit b45accce authored by Dave Pisek's avatar Dave Pisek

Maintainer feedback: Spec helper tests

* Adds test to cover `set_window_location_helper`
parent f59ae04e
import setWindowLocationHelper from './set_window_location_helper';
describe('setWindowLocationHelper', () => {
const originalLocation = window.location;
afterEach(() => {
window.location = originalLocation;
});
it.each`
locationProperty | value
${'hash'} | ${'foo'}
${'host'} | ${'gitlab.com'}
${'hostname'} | ${'gitlab.com'}
${'href'} | ${'https://gitlab.com/foo'}
${'origin'} | ${'https://gitlab.com'}
${'origin'} | ${'/foo'}
${'port'} | ${'80'}
${'protocol'} | ${'https:'}
`('sets "window.location.$locationProperty" to be $value', ({ locationProperty, value }) => {
expect(window.location[locationProperty]).not.toBe(value);
setWindowLocationHelper({
[locationProperty]: value,
});
expect(window.location[locationProperty]).toBe(value);
});
});
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