projects
/
arvados-workbench2.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
13494: Merge branch 'master' into 13494-collection-version-browser
[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 d1426c2916b75bc62c2eb3c4c3f11683fe3effe1..e25d7be9530826ff09f8c7d8845b44ea9e756fe1 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'
+ };
+ const redirectTo = '/test123';
const locationTemplate = {
hash: '',
hostname: '',
const locationTemplate = {
hash: '',
hostname: '',
@@
-16,10
+20,10
@@
describe('redirect-to', () => {
port: '80',
protocol: 'http',
search: '',
port: '80',
protocol: 'http',
search: '',
- reload: () => {},
- replace: () => {},
- assign: () => {},
- ancestorOrigins:
new DOMStringList()
,
+ reload: () => {
},
+ replace: () => {
},
+ assign: () => {
},
+ ancestorOrigins:
[]
,
href: '',
};
href: '',
};
@@
-33,8
+37,8
@@
describe('redirect-to', () => {
window.location = {
...locationTemplate,
href: `${location.href}?redirectTo=${redirectTo}`,
window.location = {
...locationTemplate,
href: `${location.href}?redirectTo=${redirectTo}`,
- };
- Object.defineProperty(window, '
session
Storage', {
+ }
as any
;
+ 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.
session
Storage.setItem).toHaveBeenCalledWith('redirectTo', redirectTo);
+ expect(window.
local
Storage.setItem).toHaveBeenCalledWith('redirectTo', redirectTo);
});
});
});
});
@@
-57,8
+61,8
@@
describe('redirect-to', () => {
window.location = {
...locationTemplate,
href: `${location.href}?redirectTo=${redirectTo}`,
window.location = {
...locationTemplate,
href: `${location.href}?redirectTo=${redirectTo}`,
- };
- Object.defineProperty(window, '
session
Storage', {
+ }
as any;
;
+ 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
+});