21037: fixed auth-middleware test Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa...
authorLisa Knox <lisaknox83@gmail.com>
Fri, 19 Apr 2024 13:28:07 +0000 (09:28 -0400)
committerLisa Knox <lisaknox83@gmail.com>
Fri, 19 Apr 2024 13:28:07 +0000 (09:28 -0400)
services/workbench2/src/store/auth/auth-middleware.test.ts

index 5a0364ebf9000162ef7544dccd0607420ba2b290..259478fdc42c8478d431929d66dd4244ece98c6d 100644 (file)
@@ -33,7 +33,9 @@ describe("AuthMiddleware", () => {
 
     it("handles LOGOUT action", () => {
         localStorage.setItem(API_TOKEN_KEY, 'someToken');
-        window.location.assign = jest.fn();
+        Object.defineProperty(window, 'location', {
+            value: { assign: jest.fn(), href: 'http://localhost', protocol: 'http:', host: 'localhost'}
+          });
         const next = jest.fn();
         const middleware = authMiddleware(services)(store)(next);
         middleware(authActions.LOGOUT({deleteLinkData: false, preservePath: false}));