diff --git a/cypress/component/ERACommons/era_commons_utils.spec.ts b/cypress/component/ERACommons/era_commons_utils.spec.ts index 93b8d26616..03a65ab0d4 100644 --- a/cypress/component/ERACommons/era_commons_utils.spec.ts +++ b/cypress/component/ERACommons/era_commons_utils.spec.ts @@ -1,12 +1,8 @@ import * as ERACommonsUtils from 'src/components/era_commons/ERACommonsUtils' -import EnvironmentUtils from 'src/utils/EnvironmentUtils' import { DuosUser } from 'src/types/model' describe('ERACommonsUtils Tests', () => { - describe('Test environment-enabled cases', () => { - beforeEach(() => { - cy.stub(EnvironmentUtils, 'checkEnv').returns(true) - }) + describe('Verify RAS is enabled', () => { it('rasEnabled', () => { const result = ERACommonsUtils.rasEnabled() expect(result).to.eq(true) @@ -21,24 +17,6 @@ describe('ERACommonsUtils Tests', () => { }) }) - describe('Test environment-disabled cases', () => { - beforeEach(() => { - cy.stub(EnvironmentUtils, 'checkEnv').returns(false) - }) - it('rasEnabled', () => { - const result = ERACommonsUtils.rasEnabled() - expect(result).to.eq(false) - }) - it('nihAccountLabel', () => { - const result = ERACommonsUtils.nihAccountLabel() - expect(result).to.eq('eRA Commons') - }) - it('nihAccountInstructions', () => { - const result = ERACommonsUtils.nihAccountInstructions() - expect(result).to.eq('https://www.era.nih.gov/register-accounts/understanding-era-commons-accounts.htm') - }) - }) - describe('extractEraAuthenticationState', () => { const futureDate = new Date() futureDate.setDate(futureDate.getDate() + 30) diff --git a/cypress/component/UserProfile/researcher_status.spec.tsx b/cypress/component/UserProfile/researcher_status.spec.tsx index 625d9793bd..b5489e6dbb 100644 --- a/cypress/component/UserProfile/researcher_status.spec.tsx +++ b/cypress/component/UserProfile/researcher_status.spec.tsx @@ -82,7 +82,7 @@ describe('ResearcherStatus', () => { mount() cy.contains('Researcher Status') - cy.contains('eRA Commons Account') + cy.contains('RAS Account') cy.contains('Library Card issued to you') cy.contains('Issued on: ' + userWithCard.libraryCard?.createDate.toISOString().slice(0, 10)) cy.contains('Issued by: ' + signingOfficialUser.displayName) diff --git a/cypress/component/app.spec.jsx b/cypress/component/app.spec.jsx index 9d3c49f748..32a80fc70c 100644 --- a/cypress/component/app.spec.jsx +++ b/cypress/component/app.spec.jsx @@ -4,11 +4,10 @@ import App from 'src/App' import ReactGA from 'react-ga4' import StackdriverReporter from 'src/libs/stackdriverReporter' import { Config } from 'src/libs/config' -import { MemoryRouter, Route } from 'react-router-dom' +import { MemoryRouter, Route, Router } from 'react-router-dom' import { AuthenticateNIH } from 'src/libs/ajax/AuthenticateNIH' import { Storage } from 'src/libs/storage' import { createMemoryHistory } from 'history' -import { Router } from 'react-router' import { ServiceStatus } from 'src/libs/ajax/ServiceStatus' const user = { diff --git a/src/components/era_commons/ERACommons.tsx b/src/components/era_commons/ERACommons.tsx index 72afc86f7b..09db25f01f 100644 --- a/src/components/era_commons/ERACommons.tsx +++ b/src/components/era_commons/ERACommons.tsx @@ -129,7 +129,9 @@ export default function ERACommons({ // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error catch (error: never) { - displayError('Error from Authentication Provider: ' + error?.response?.data?.message + ': ' + currentUser.email) + const userEmail = currentUser?.email || 'unknown user' + const errorMessage = 'Error from Authentication Provider: ' + error?.response?.data?.message + ': ' + userEmail + displayError(errorMessage) } } diff --git a/src/components/era_commons/ERACommonsUtils.ts b/src/components/era_commons/ERACommonsUtils.ts index 16387ed508..6ba6e8b1b3 100644 --- a/src/components/era_commons/ERACommonsUtils.ts +++ b/src/components/era_commons/ERACommonsUtils.ts @@ -1,8 +1,7 @@ -import EnvironmentUtils, { envGroups } from 'src/utils/EnvironmentUtils' import { DuosUser } from 'src/types/model' export const rasEnabled = (): boolean => { - return EnvironmentUtils.checkEnv(envGroups.NON_PROD) + return true } export const nihAccountLabel = () => {