projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
18946: Don't navigate away from my-account page on password login
[arvados.git]
/
src
/
common
/
redirect-to.test.ts
diff --git
a/src/common/redirect-to.test.ts
b/src/common/redirect-to.test.ts
index 177e16566896e6f6d723d457ce7850d6b70b3444..0168fd803f327f484be2f848e805d4df503352b3 100644
(file)
--- a/
src/common/redirect-to.test.ts
+++ b/
src/common/redirect-to.test.ts
@@
-7,7
+7,8
@@
import { storeRedirects, handleRedirects } from './redirect-to';
describe('redirect-to', () => {
const { location } = window;
const config: any = {
describe('redirect-to', () => {
const { location } = window;
const config: any = {
- keepWebServiceUrl: 'http://localhost'
+ keepWebServiceUrl: 'http://localhost',
+ keepWebServiceInlineUrl: 'http://localhost-inline'
};
const redirectTo = '/test123';
const locationTemplate = {
};
const redirectTo = '/test123';
const locationTemplate = {
@@
-19,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: '',
};
@@
-35,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(),
},
@@
-50,7
+51,7
@@
describe('redirect-to', () => {
storeRedirects();
// then
storeRedirects();
// then
- expect(window.
sessionStorage.setItem).toHaveBeenCalledWith('redirectTo
', redirectTo);
+ expect(window.
localStorage.setItem).toHaveBeenCalledWith('redirectToDownload
', redirectTo);
});
});
});
});
@@
-59,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(),
@@
-72,10
+73,10
@@
describe('redirect-to', () => {
it('should redirect to page when it is present in session storage', () => {
// when
it('should redirect to page when it is present in session storage', () => {
// when
- handleRedirects(config);
+ handleRedirects(
"abcxyz",
config);
// then
// then
- expect(window.location.href).toBe(`${config.keepWebServiceUrl}${redirectTo}`);
+ expect(window.location.href).toBe(`${config.keepWebServiceUrl}${redirectTo}
?api_token=abcxyz
`);
});
});
});
});
-});
\ No newline at end of file
+});