From af7865e019f472befea5c73aed62ff298ad7a2b0 Mon Sep 17 00:00:00 2001 From: Lisa Knox Date: Tue, 23 Jul 2024 11:26:57 -0400 Subject: [PATCH] 21720: * updated auth-reducer test Arvados-DCO-1.1-Signed-off-by: Lisa Knox --- ...uth-reducer.test.ts => auth-reducer.cy.js} | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) rename services/workbench2/src/store/auth/{auth-reducer.test.ts => auth-reducer.cy.js} (83%) diff --git a/services/workbench2/src/store/auth/auth-reducer.test.ts b/services/workbench2/src/store/auth/auth-reducer.cy.js similarity index 83% rename from services/workbench2/src/store/auth/auth-reducer.test.ts rename to services/workbench2/src/store/auth/auth-reducer.cy.js index 0d83e390ed..bb9f625597 100644 --- a/services/workbench2/src/store/auth/auth-reducer.test.ts +++ b/services/workbench2/src/store/auth/auth-reducer.cy.js @@ -2,22 +2,19 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { authReducer, AuthState } from "./auth-reducer"; -import { AuthAction, authActions } from "./auth-action"; - -import 'jest-localstorage-mock'; +import { authReducer } from "./auth-reducer"; +import { authActions } from "./auth-action"; 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) => { } + let reducer; + const actions = { + progressFn: (id, working) => { }, + errorFn: (id, message) => { } }; - beforeAll(() => { + before(() => { localStorage.clear(); reducer = authReducer(createServices(mockConfig({}), actions)); }); @@ -38,12 +35,16 @@ describe('auth-reducer', () => { canManage: false, }; const state = reducer(initialState, authActions.INIT_USER({ user, token: "token" })); - expect(state).toEqual({ + expect(state).to.deep.equal({ apiToken: "token", + apiTokenExpiration: undefined, + apiTokenLocation: undefined, config: mockConfig({}), user, sshKeys: [], sessions: [], + extraApiToken: undefined, + extraApiTokenExpiration: undefined, homeCluster: "zzzzz", localCluster: "", loginCluster: "", @@ -70,7 +71,7 @@ describe('auth-reducer', () => { }; const state = reducer(initialState, authActions.USER_DETAILS_SUCCESS(user)); - expect(state).toEqual({ + expect(state).to.deep.equal({ apiToken: undefined, apiTokenExpiration: undefined, apiTokenLocation: undefined, -- 2.30.2