Skip to content

Commit 5034723

Browse files
authored
[DT-1329] Enable RAS in production (#3039)
1 parent 3ab5f69 commit 5034723

File tree

5 files changed

+7
-29
lines changed

5 files changed

+7
-29
lines changed

cypress/component/ERACommons/era_commons_utils.spec.ts

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
import * as ERACommonsUtils from 'src/components/era_commons/ERACommonsUtils'
2-
import EnvironmentUtils from 'src/utils/EnvironmentUtils'
32
import { DuosUser } from 'src/types/model'
43

54
describe('ERACommonsUtils Tests', () => {
6-
describe('Test environment-enabled cases', () => {
7-
beforeEach(() => {
8-
cy.stub(EnvironmentUtils, 'checkEnv').returns(true)
9-
})
5+
describe('Verify RAS is enabled', () => {
106
it('rasEnabled', () => {
117
const result = ERACommonsUtils.rasEnabled()
128
expect(result).to.eq(true)
@@ -21,24 +17,6 @@ describe('ERACommonsUtils Tests', () => {
2117
})
2218
})
2319

24-
describe('Test environment-disabled cases', () => {
25-
beforeEach(() => {
26-
cy.stub(EnvironmentUtils, 'checkEnv').returns(false)
27-
})
28-
it('rasEnabled', () => {
29-
const result = ERACommonsUtils.rasEnabled()
30-
expect(result).to.eq(false)
31-
})
32-
it('nihAccountLabel', () => {
33-
const result = ERACommonsUtils.nihAccountLabel()
34-
expect(result).to.eq('eRA Commons')
35-
})
36-
it('nihAccountInstructions', () => {
37-
const result = ERACommonsUtils.nihAccountInstructions()
38-
expect(result).to.eq('https://www.era.nih.gov/register-accounts/understanding-era-commons-accounts.htm')
39-
})
40-
})
41-
4220
describe('extractEraAuthenticationState', () => {
4321
const futureDate = new Date()
4422
futureDate.setDate(futureDate.getDate() + 30)

cypress/component/UserProfile/researcher_status.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ describe('ResearcherStatus', () => {
8282

8383
mount(<ResearcherStatus user={userWithCard} pageProps={pageProps} />)
8484
cy.contains('Researcher Status')
85-
cy.contains('eRA Commons Account')
85+
cy.contains('RAS Account')
8686
cy.contains('Library Card issued to you')
8787
cy.contains('Issued on: ' + userWithCard.libraryCard?.createDate.toISOString().slice(0, 10))
8888
cy.contains('Issued by: ' + signingOfficialUser.displayName)

cypress/component/app.spec.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ import App from 'src/App'
44
import ReactGA from 'react-ga4'
55
import StackdriverReporter from 'src/libs/stackdriverReporter'
66
import { Config } from 'src/libs/config'
7-
import { MemoryRouter, Route } from 'react-router-dom'
7+
import { MemoryRouter, Route, Router } from 'react-router-dom'
88
import { AuthenticateNIH } from 'src/libs/ajax/AuthenticateNIH'
99
import { Storage } from 'src/libs/storage'
1010
import { createMemoryHistory } from 'history'
11-
import { Router } from 'react-router'
1211
import { ServiceStatus } from 'src/libs/ajax/ServiceStatus'
1312

1413
const user = {

src/components/era_commons/ERACommons.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ export default function ERACommons({
129129
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
130130
// @ts-expect-error
131131
catch (error: never) {
132-
displayError('Error from Authentication Provider: ' + error?.response?.data?.message + ': ' + currentUser.email)
132+
const userEmail = currentUser?.email || 'unknown user'
133+
const errorMessage = 'Error from Authentication Provider: ' + error?.response?.data?.message + ': ' + userEmail
134+
displayError(errorMessage)
133135
}
134136
}
135137

src/components/era_commons/ERACommonsUtils.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import EnvironmentUtils, { envGroups } from 'src/utils/EnvironmentUtils'
21
import { DuosUser } from 'src/types/model'
32

43
export const rasEnabled = (): boolean => {
5-
return EnvironmentUtils.checkEnv(envGroups.NON_PROD)
4+
return true
65
}
76

87
export const nihAccountLabel = () => {

0 commit comments

Comments
 (0)