X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/27bcade93df26e25bb2b4aff537875f78d3c1ff5..d4068786fd7136cfe21c3ef3ad3040f57ed3385a:/src/store/auth/auth-reducer.test.ts diff --git a/src/store/auth/auth-reducer.test.ts b/src/store/auth/auth-reducer.test.ts index 0e05263d..25ce2c11 100644 --- a/src/store/auth/auth-reducer.test.ts +++ b/src/store/auth/auth-reducer.test.ts @@ -6,14 +6,20 @@ import { authReducer, AuthState } from "./auth-reducer"; import { AuthAction, authActions } from "./auth-action"; import 'jest-localstorage-mock'; -import { createServices } from "../../services/services"; +import { createServices } from "~/services/services"; +import { mockConfig } from '~/common/config'; +import { ApiActions } from "~/services/api/api-actions"; describe('auth-reducer', () => { let reducer: (state: AuthState | undefined, action: AuthAction) => any; + const actions: ApiActions = { + progressFn: (id: string, working: boolean) => {}, + errorFn: (id: string, message: string) => {} + }; beforeAll(() => { localStorage.clear(); - reducer = authReducer(createServices("/arvados/v1")); + reducer = authReducer(createServices(mockConfig({}), actions)); }); it('should correctly initialise state', () => { @@ -25,7 +31,7 @@ describe('auth-reducer', () => { uuid: "uuid", ownerUuid: "ownerUuid" }; - const state = reducer(initialState, authActions.INIT({user, token: "token"})); + const state = reducer(initialState, authActions.INIT({ user, token: "token" })); expect(state).toEqual({ apiToken: "token", user @@ -38,7 +44,8 @@ describe('auth-reducer', () => { const state = reducer(initialState, authActions.SAVE_API_TOKEN("token")); expect(state).toEqual({ apiToken: "token", - user: undefined + user: undefined, + sshKeys: [] }); }); @@ -56,6 +63,7 @@ describe('auth-reducer', () => { const state = reducer(initialState, authActions.USER_DETAILS_SUCCESS(user)); expect(state).toEqual({ apiToken: undefined, + sshKeys: [], user: { email: "test@test.com", firstName: "John",