blob: e3efc104862947c19c3f6890de773b3e36cc8172 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
import createRouter from '~/vue_shared/alert_details/router';
import setWindowLocation from 'helpers/set_window_location_helper';
const BASE_PATH = '/-/alert_management/1/details';
const EMPTY_HASH = '';
const NOOP = () => {};
describe('AlertDetails router', () => {
const originalLocation = window.location.href;
let router;
beforeEach(() => {
setWindowLocation(originalLocation);
router = createRouter(BASE_PATH);
});
describe('redirects hash route mode URLs to history route mode', () => {
it.each`
hashPath | historyPath
${'/#/overview'} | ${'/overview'}
${'#/overview'} | ${'/overview'}
${'/#/'} | ${'/'}
${'#/'} | ${'/'}
${'/#'} | ${'/'}
${'#'} | ${'/'}
${'/'} | ${'/'}
${'/overview'} | ${'/overview'}
`('should redirect "$hashPath" to "$historyPath"', ({ hashPath, historyPath }) => {
router.push(hashPath, NOOP);
expect(window.location.hash).toBe(EMPTY_HASH);
expect(window.location.pathname).toBe(BASE_PATH + historyPath);
});
});
});
|