From: Daniel Kutyła Date: Tue, 29 Sep 2020 20:47:12 +0000 (+0200) Subject: 16812: Added proper location template X-Git-Tag: 2.1.1~9^2~8 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/2e31a473f22dcea24eaa2e1dbf1b7078647548e1 16812: Added proper location template Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła --- diff --git a/src/common/redirect-to.test.ts b/src/common/redirect-to.test.ts index eed5b4c8..d1426c29 100644 --- a/src/common/redirect-to.test.ts +++ b/src/common/redirect-to.test.ts @@ -7,6 +7,21 @@ import { storeRedirects, handleRedirects } from './redirect-to'; describe('redirect-to', () => { const { location } = window; const redirectTo = 'http://localhost/test123'; + const locationTemplate = { + hash: '', + hostname: '', + origin: '', + host: '', + pathname: '', + port: '80', + protocol: 'http', + search: '', + reload: () => {}, + replace: () => {}, + assign: () => {}, + ancestorOrigins: new DOMStringList(), + href: '', + }; afterAll((): void => { window.location = location; @@ -16,8 +31,9 @@ describe('redirect-to', () => { beforeEach(() => { delete window.location; window.location = { + ...locationTemplate, href: `${location.href}?redirectTo=${redirectTo}`, - } as any; + }; Object.defineProperty(window, 'sessionStorage', { value: { setItem: jest.fn(), @@ -39,8 +55,9 @@ describe('redirect-to', () => { beforeEach(() => { delete window.location; window.location = { + ...locationTemplate, href: `${location.href}?redirectTo=${redirectTo}`, - } as any; + }; Object.defineProperty(window, 'sessionStorage', { value: { getItem: () => redirectTo,