projects
/
arvados-workbench2.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
16812: Another way of testing href
[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 94000a98c489beb49f990987bd52b31efb318600..3dad8233034711c93fb0b3b198a6aaa458263a6e 100644
(file)
--- a/
src/common/redirect-to.test.ts
+++ b/
src/common/redirect-to.test.ts
@@
-5,16
+5,19
@@
import { storeRedirects, handleRedirects } from './redirect-to';
describe('redirect-to', () => {
import { storeRedirects, handleRedirects } from './redirect-to';
describe('redirect-to', () => {
+ const { location } = window;
const redirectTo = 'http://localhost/test123';
const redirectTo = 'http://localhost/test123';
+ afterAll((): void => {
+ window.location = location;
+ });
+
describe('storeRedirects', () => {
beforeEach(() => {
describe('storeRedirects', () => {
beforeEach(() => {
- Object.defineProperty(window, 'location', {
- value: {
- href: `${window.location.href}?redirectTo=${redirectTo}`
- },
- writable: true
- });
+ delete window.location;
+ window.location = {
+ href: `${location.href}?redirectTo=${redirectTo}`,
+ };
Object.defineProperty(window, 'sessionStorage', {
value: {
setItem: jest.fn(),
Object.defineProperty(window, 'sessionStorage', {
value: {
setItem: jest.fn(),
@@
-34,12
+37,10
@@
describe('redirect-to', () => {
describe('handleRedirects', () => {
beforeEach(() => {
describe('handleRedirects', () => {
beforeEach(() => {
- Object.defineProperty(window, 'location', {
- value: {
- href: ''
- },
- writable: true
- });
+ delete window.location;
+ window.location = {
+ href: `${location.href}?redirectTo=${redirectTo}`,
+ };
Object.defineProperty(window, 'sessionStorage', {
value: {
getItem: () => redirectTo,
Object.defineProperty(window, 'sessionStorage', {
value: {
getItem: () => redirectTo,