X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/1bbdd9c70d0099e0bf46b3c1ac55e423e3406314..72ee613468c6dee53b98ed1469ce9781a942dbe9:/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 8cde324549..756feeeb6b 100644 --- a/src/store/auth/auth-reducer.test.ts +++ b/src/store/auth/auth-reducer.test.ts @@ -13,8 +13,8 @@ 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) => {} + progressFn: (id: string, working: boolean) => { }, + errorFn: (id: string, message: string) => { } }; beforeAll(() => { @@ -28,25 +28,25 @@ describe('auth-reducer', () => { email: "test@test.com", firstName: "John", lastName: "Doe", - uuid: "uuid", - ownerUuid: "ownerUuid" + uuid: "zzzzz-tpzed-xurymjxw79nv3jz", + ownerUuid: "ownerUuid", + username: "username", + prefs: {}, + isAdmin: false, + isActive: true }; - const state = reducer(initialState, authActions.INIT({ user, token: "token" })); + const state = reducer(initialState, authActions.INIT_USER({ user, token: "token" })); expect(state).toEqual({ apiToken: "token", + config: mockConfig({}), user, - sshKeys: [] - }); - }); - - it('should save api token', () => { - const initialState = undefined; - - const state = reducer(initialState, authActions.SAVE_API_TOKEN("token")); - expect(state).toEqual({ - apiToken: "token", - user: undefined, - sshKeys: [] + sshKeys: [], + sessions: [], + homeCluster: "zzzzz", + localCluster: "", + loginCluster: "", + remoteHosts: {}, + remoteHostsConfig: {} }); }); @@ -58,19 +58,34 @@ describe('auth-reducer', () => { firstName: "John", lastName: "Doe", uuid: "uuid", - ownerUuid: "ownerUuid" + ownerUuid: "ownerUuid", + username: "username", + prefs: {}, + isAdmin: false, + isActive: true }; const state = reducer(initialState, authActions.USER_DETAILS_SUCCESS(user)); expect(state).toEqual({ apiToken: undefined, + config: mockConfig({}), sshKeys: [], + sessions: [], + homeCluster: "uuid", + localCluster: "", + loginCluster: "", + remoteHosts: {}, + remoteHostsConfig: {}, user: { email: "test@test.com", firstName: "John", lastName: "Doe", uuid: "uuid", ownerUuid: "ownerUuid", + username: "username", + prefs: {}, + isAdmin: false, + isActive: true } }); });