19295: Add "Reused" state to container status display
[arvados.git] / src / store / auth / auth-reducer.test.ts
index e008818234e23a5fc5069a857711ecdfad813271..6a1fb87faa8c10d8fc30a47bc3005c3ead1a3df0 100644 (file)
@@ -6,9 +6,9 @@ import { authReducer, AuthState } from "./auth-reducer";
 import { AuthAction, authActions } from "./auth-action";
 
 import 'jest-localstorage-mock';
-import { createServices } from "~/services/services";
-import { mockConfig } from '~/common/config';
-import { ApiActions } from "~/services/api/api-actions";
+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;
@@ -33,33 +33,20 @@ describe('auth-reducer', () => {
             username: "username",
             prefs: {},
             isAdmin: false,
-            isActive: true,
-            createdAt: "createdAt"
+            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: [],
             sessions: [],
             homeCluster: "zzzzz",
             localCluster: "",
-            remoteHosts: {}
-        });
-    });
-
-    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: [],
-            sessions: [],
-            homeCluster: "",
-            localCluster: "",
+            loginCluster: "",
             remoteHosts: {},
+            remoteHostsConfig: {}
         });
     });
 
@@ -75,18 +62,20 @@ describe('auth-reducer', () => {
             username: "username",
             prefs: {},
             isAdmin: false,
-            isActive: true,
-            createdAt: "createdAt"
+            isActive: true
         };
 
         const state = reducer(initialState, authActions.USER_DETAILS_SUCCESS(user));
         expect(state).toEqual({
             apiToken: undefined,
+            config: mockConfig({}),
             sshKeys: [],
             sessions: [],
-            homeCluster: "",
+            homeCluster: "uuid",
             localCluster: "",
+            loginCluster: "",
             remoteHosts: {},
+            remoteHostsConfig: {},
             user: {
                 email: "test@test.com",
                 firstName: "John",
@@ -96,8 +85,7 @@ describe('auth-reducer', () => {
                 username: "username",
                 prefs: {},
                 isAdmin: false,
-                isActive: true,
-                createdAt: "createdAt"
+                isActive: true
             }
         });
     });