Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/vue_shared/alert_details/router_spec.js')
-rw-r--r--spec/frontend/vue_shared/alert_details/router_spec.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/frontend/vue_shared/alert_details/router_spec.js b/spec/frontend/vue_shared/alert_details/router_spec.js
new file mode 100644
index 00000000000..e3efc104862
--- /dev/null
+++ b/spec/frontend/vue_shared/alert_details/router_spec.js
@@ -0,0 +1,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);
+ });
+ });
+});