16159: Passes the token to be expire when calling the logout endpoint.
[arvados-workbench2.git] / src / store / auth / auth-middleware.test.ts
index 1fe34381d941372a79b0b3835703895807cffc29..1438cab35a121bb9f7f63668a1c1d31906afd864 100644 (file)
@@ -18,6 +18,7 @@ describe("AuthMiddleware", () => {
     let store: RootStore;
     let services: ServiceRepository;
     let axiosInst: AxiosInstance;
+    const config: any = {};
     const actions: ApiActions = {
         progressFn: (id: string, working: boolean) => { },
         errorFn: (id: string, message: string) => { }
@@ -26,7 +27,7 @@ describe("AuthMiddleware", () => {
     beforeEach(() => {
         axiosInst = Axios.create({ headers: {} });
         services = createServices(mockConfig({}), actions, axiosInst);
-        store = configureStore(createBrowserHistory(), services);
+        store = configureStore(createBrowserHistory(), services, config);
         localStorage.clear();
     });
 
@@ -37,7 +38,7 @@ describe("AuthMiddleware", () => {
         const middleware = authMiddleware(services)(store)(next);
         middleware(authActions.LOGOUT({deleteLinkData: false}));
         expect(window.location.assign).toBeCalledWith(
-            `/logout?return_to=${location.protocol}//${location.host}`
+            `/logout?api_token=someToken&return_to=${location.protocol}//${location.host}`
         );
         expect(localStorage.getItem(API_TOKEN_KEY)).toBeFalsy();
     });