Merge branch '21128-toolbar-context-menu'
[arvados-workbench2.git] / src / common / redirect-to.test.ts
index c7d3a84e8cec8ca42e4c0233117a760478b0524c..adb52f4b0ce494167170c02390433a4ba82dec9f 100644 (file)
@@ -7,9 +7,10 @@ import { storeRedirects, handleRedirects } from './redirect-to';
 describe('redirect-to', () => {
     const { location } = window;
     const config: any = {
-        keepWebServiceUrl: 'http://localhost'
+        keepWebServiceUrl: 'http://localhost',
+        keepWebServiceInlineUrl: 'http://localhost-inline'
     };
-    const redirectTo = '/test123';
+    const redirectTo = 'c=acbd18db4cc2f85cedef654fccc4a4d8%2B3/foo';
     const locationTemplate = {
         hash: '',
         hostname: '',
@@ -35,9 +36,9 @@ describe('redirect-to', () => {
             delete window.location;
             window.location = {
                 ...locationTemplate,
-                href: `${location.href}?redirectTo=${redirectTo}`,
+                href: `${location.href}?redirectToDownload=${redirectTo}`,
             } as any;
-            Object.defineProperty(window, 'sessionStorage', {
+            Object.defineProperty(window, 'localStorage', {
                 value: {
                     setItem: jest.fn(),
                 },
@@ -50,7 +51,7 @@ describe('redirect-to', () => {
             storeRedirects();
 
             // then
-            expect(window.sessionStorage.setItem).toHaveBeenCalledWith('redirectTo', redirectTo);
+            expect(window.localStorage.setItem).toHaveBeenCalledWith('redirectToDownload', decodeURIComponent(redirectTo));
         });
     });
 
@@ -59,9 +60,9 @@ describe('redirect-to', () => {
             delete window.location;
             window.location = {
                 ...locationTemplate,
-                href: `${location.href}?redirectTo=${redirectTo}`,
+                href: `${location.href}?redirectToDownload=${redirectTo}`,
             } as any;;
-            Object.defineProperty(window, 'sessionStorage', {
+            Object.defineProperty(window, 'localStorage', {
                 value: {
                     getItem: () => redirectTo,
                     removeItem: jest.fn(),