Fix tests refs #15230
[arvados-workbench2.git] / src / store / auth / auth-reducer.test.ts
index 1202bacb125b5e1afc61908cb64f9953946b41f6..14d92803cc1fc21750d662d723ded60c2d3221ad 100644 (file)
@@ -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,13 +28,23 @@ 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" }));
         expect(state).toEqual({
             apiToken: "token",
-            user
+            user,
+            sshKeys: [],
+            sessions: [],
+            homeCluster: "zzzzz",
+            localCluster: "",
+            remoteHosts: {},
+            remoteHostsConfig: {}
         });
     });
 
@@ -44,7 +54,13 @@ describe('auth-reducer', () => {
         const state = reducer(initialState, authActions.SAVE_API_TOKEN("token"));
         expect(state).toEqual({
             apiToken: "token",
-            user: undefined
+            user: undefined,
+            sshKeys: [],
+            sessions: [],
+            homeCluster: "",
+            localCluster: "",
+            remoteHosts: {},
+            remoteHostsConfig: {}
         });
     });
 
@@ -56,18 +72,32 @@ 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,
+            sshKeys: [],
+            sessions: [],
+            homeCluster: "",
+            localCluster: "",
+            remoteHosts: {},
+            remoteHostsConfig: {},
             user: {
                 email: "test@test.com",
                 firstName: "John",
                 lastName: "Doe",
                 uuid: "uuid",
                 ownerUuid: "ownerUuid",
+                username: "username",
+                prefs: {},
+                isAdmin: false,
+                isActive: true
             }
         });
     });