projects
/
arvados-workbench2.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote-tracking branch 'origin/main' into 18692-frozen-projects-workbench-support
[arvados-workbench2.git]
/
src
/
common
/
redirect-to.test.ts
diff --git
a/src/common/redirect-to.test.ts
b/src/common/redirect-to.test.ts
index ad8ac9e0c2354680948848ff1ba35593a61ee010..0168fd803f327f484be2f848e805d4df503352b3 100644
(file)
--- a/
src/common/redirect-to.test.ts
+++ b/
src/common/redirect-to.test.ts
@@
-6,7
+6,11
@@
import { storeRedirects, handleRedirects } from './redirect-to';
describe('redirect-to', () => {
const { location } = window;
describe('redirect-to', () => {
const { location } = window;
- const redirectTo = 'http://localhost/test123';
+ const config: any = {
+ keepWebServiceUrl: 'http://localhost',
+ keepWebServiceInlineUrl: 'http://localhost-inline'
+ };
+ const redirectTo = '/test123';
const locationTemplate = {
hash: '',
hostname: '',
const locationTemplate = {
hash: '',
hostname: '',
@@
-16,9
+20,9
@@
describe('redirect-to', () => {
port: '80',
protocol: 'http',
search: '',
port: '80',
protocol: 'http',
search: '',
- reload: () => {},
- replace: () => {},
- assign: () => {},
+ reload: () => {
},
+ replace: () => {
},
+ assign: () => {
},
ancestorOrigins: [],
href: '',
};
ancestorOrigins: [],
href: '',
};
@@
-32,9
+36,9
@@
describe('redirect-to', () => {
delete window.location;
window.location = {
...locationTemplate,
delete window.location;
window.location = {
...locationTemplate,
- href: `${location.href}?redirectTo=${redirectTo}`,
+ href: `${location.href}?redirectTo
Download
=${redirectTo}`,
} as any;
} as any;
- Object.defineProperty(window, '
session
Storage', {
+ Object.defineProperty(window, '
local
Storage', {
value: {
setItem: jest.fn(),
},
value: {
setItem: jest.fn(),
},
@@
-47,7
+51,7
@@
describe('redirect-to', () => {
storeRedirects();
// then
storeRedirects();
// then
- expect(window.
sessionStorage.setItem).toHaveBeenCalledWith('redirectTo
', redirectTo);
+ expect(window.
localStorage.setItem).toHaveBeenCalledWith('redirectToDownload
', redirectTo);
});
});
});
});
@@
-56,9
+60,9
@@
describe('redirect-to', () => {
delete window.location;
window.location = {
...locationTemplate,
delete window.location;
window.location = {
...locationTemplate,
- href: `${location.href}?redirectTo=${redirectTo}`,
+ href: `${location.href}?redirectTo
Download
=${redirectTo}`,
} as any;;
} as any;;
- Object.defineProperty(window, '
session
Storage', {
+ Object.defineProperty(window, '
local
Storage', {
value: {
getItem: () => redirectTo,
removeItem: jest.fn(),
value: {
getItem: () => redirectTo,
removeItem: jest.fn(),
@@
-68,14
+72,11
@@
describe('redirect-to', () => {
});
it('should redirect to page when it is present in session storage', () => {
});
it('should redirect to page when it is present in session storage', () => {
- // given
- const token = 'testToken';
-
// when
// when
- handleRedirects(
token
);
+ handleRedirects(
"abcxyz", config
);
// then
// then
- expect(window.location.href).toBe(`${
redirectTo}?api_token=${token}
`);
+ expect(window.location.href).toBe(`${
config.keepWebServiceUrl}${redirectTo}?api_token=abcxyz
`);
});
});
});
});
-});
\ No newline at end of file
+});