X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/ecd0b3c069eed7d411e3cec7d707b43ab6675081..da1b362fc33261ace42851f6900df7b96fde819e:/src/store/auth/auth-middleware.test.ts diff --git a/src/store/auth/auth-middleware.test.ts b/src/store/auth/auth-middleware.test.ts index 1fe34381d9..5a0364ebf9 100644 --- a/src/store/auth/auth-middleware.test.ts +++ b/src/store/auth/auth-middleware.test.ts @@ -8,16 +8,17 @@ import { createBrowserHistory } from "history"; import { authMiddleware } from "./auth-middleware"; import { RootStore, configureStore } from "../store"; -import { ServiceRepository, createServices } from "~/services/services"; -import { ApiActions } from "~/services/api/api-actions"; -import { mockConfig } from "~/common/config"; +import { ServiceRepository, createServices } from "services/services"; +import { ApiActions } from "services/api/api-actions"; +import { mockConfig } from "common/config"; import { authActions } from "./auth-action"; -import { API_TOKEN_KEY } from '~/services/auth-service/auth-service'; +import { API_TOKEN_KEY } from 'services/auth-service/auth-service'; 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(); }); @@ -35,10 +36,10 @@ describe("AuthMiddleware", () => { window.location.assign = jest.fn(); const next = jest.fn(); const middleware = authMiddleware(services)(store)(next); - middleware(authActions.LOGOUT({deleteLinkData: false})); + middleware(authActions.LOGOUT({deleteLinkData: false, preservePath: 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(); }); -}); \ No newline at end of file +});