Skip to content

Commit a1d5b60

Browse files
committed
fix: remove hard-coded INS values and tests for the oauth predirect feature
1 parent 92d38b0 commit a1d5b60

File tree

5 files changed

+23
-113
lines changed

5 files changed

+23
-113
lines changed

src/views/oauth/OAuthDefault.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@ import useAnalyticsEvent from 'src/hooks/useAnalyticsEvent'
2121
import { AnalyticEvents, PageviewInfo } from 'src/const/Analytics'
2222
import { useApi } from 'src/context/ApiContext'
2323
import { PredirectInstructions } from 'src/views/oauth/experiments/PredirectInstructions'
24-
import { isWellsFargoInstitution } from 'src/views/oauth/experiments/predirectInstructionsUtils'
2524

2625
export const OAuthDefault = (props) => {
2726
// Experiment code - Remove after experiment is over
2827
const language = window?.app?.options?.language || 'en-US'
29-
const isWellsFargo = isWellsFargoInstitution(props.institution)
3028

3129
const hasPredirectInstructions =
3230
Array.isArray(props.institution?.oauth_predirect_instructions) &&
@@ -50,10 +48,7 @@ export const OAuthDefault = (props) => {
5048

5149
return (
5250
<div role="alert">
53-
{/* This check allows us to merge our frontend code before the backend is ready.
54-
Wells Fargo will continue to get the special treatment, and other institutions
55-
will only start seeing the pre-redirect instructions once the backend is ready. */}
56-
{isWellsFargo || hasPredirectInstructions ? (
51+
{hasPredirectInstructions ? (
5752
<>
5853
<PredirectInstructions institution={props?.institution} />
5954
</>

src/views/oauth/experiments/PredirectInstructions.tsx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ import { Divider, Paper } from '@mui/material'
88
import { ExampleCheckbox } from 'src/components/ExampleCheckbox'
99
import {
1010
getInstitutionBrandColor,
11-
isWellsFargoInstitution,
1211
OAUTH_PREDIRECT_INSTRUCTION,
1312
} from 'src/views/oauth/experiments/predirectInstructionsUtils'
1413

15-
export const WELLS_FARGO_INSTRUCTIONS_FEATURE_NAME = 'WELLS_FARGO_INSTRUCTIONS'
1614
export const DEFAULT_HEADER_HEX_COLOR = '#444444'
1715

1816
function PredirectInstructions(
@@ -29,18 +27,6 @@ function PredirectInstructions(
2927
)
3028
: []
3129

32-
// Give Wells Fargo a default predirect instruction if none are configured, because we experimented on
33-
// Wells Fargo, and want to maintain the experience, until it is fully configured in the backend.
34-
if (isWellsFargoInstitution(props.institution) && configuredPredirectInstructions.length === 0) {
35-
configuredPredirectInstructions.push(
36-
OAUTH_PREDIRECT_INSTRUCTION.ACCOUNT_AND_TRANSACTIONS_INSTRUCTION,
37-
)
38-
39-
configuredPredirectInstructions.push(
40-
OAUTH_PREDIRECT_INSTRUCTION.PROFILE_INFORMATION_INSTRUCTION,
41-
)
42-
}
43-
4430
// If the instructions are still empty, provide a default of account and transactions
4531
// for a better user experience.
4632
if (configuredPredirectInstructions.length === 0) {

src/views/oauth/experiments/__tests__/PredirectInstructions-test.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ import { DEFAULT_HEADER_HEX_COLOR } from 'src/views/oauth/experiments/PredirectI
77
import { OAUTH_PREDIRECT_INSTRUCTION } from 'src/views/oauth/experiments/predirectInstructionsUtils'
88

99
describe('<OAuthDefault /> PredirectInstructions test', () => {
10-
it('wells fargo can show the instructions for verification/identity', async () => {
10+
it('Any Bank can show the instructions for verification/identity', async () => {
1111
const onSignInClick = vi.fn()
1212
const onAnalyticsEvent = vi.fn()
1313

1414
const institution = {
15-
guid: 'INS-f9e8d5f6-b953-da63-32e4-6e88fbe8b250',
16-
name: 'Wells Fargo',
15+
guid: 'INS-123',
16+
name: 'Any Bank',
1717
testProp: 'testValue',
1818
oauth_predirect_instructions: [
1919
OAUTH_PREDIRECT_INSTRUCTION.ACCOUNT_AND_TRANSACTIONS_INSTRUCTION,
@@ -27,7 +27,7 @@ describe('<OAuthDefault /> PredirectInstructions test', () => {
2727
isOauthLoading: false,
2828
oauthURL: 'testUrl',
2929
selectedInstitution: {
30-
name: 'Wells Fargo',
30+
name: 'Any Bank',
3131
},
3232
},
3333
})
@@ -52,8 +52,8 @@ describe('<OAuthDefault /> PredirectInstructions test', () => {
5252
)
5353

5454
// See PredirectInstructions.tsx for the text we are verifying here
55-
expect(screen.getByText('Wells Fargo')).toBeInTheDocument()
56-
expect(screen.getByText('Log in at Wells Fargo', { selector: 'h2' })).toBeInTheDocument()
55+
expect(screen.getByText('Any Bank')).toBeInTheDocument()
56+
expect(screen.getByText('Log in at Any Bank', { selector: 'h2' })).toBeInTheDocument()
5757

5858
expect(
5959
screen.getByText((content, element) => {
@@ -71,13 +71,13 @@ describe('<OAuthDefault /> PredirectInstructions test', () => {
7171
expect(screen.getByText('Profile information')).toBeInTheDocument()
7272
})
7373

74-
it('wells fargo can show instructions for aggregation-only', async () => {
74+
it('Any Bank can show instructions for aggregation-only', async () => {
7575
const onSignInClick = vi.fn()
7676
const onAnalyticsEvent = vi.fn()
7777

7878
const institution = {
79-
guid: 'INS-f9e8d5f6-b953-da63-32e4-6e88fbe8b250',
80-
name: 'Wells Fargo',
79+
guid: 'INS-123',
80+
name: 'Any Bank',
8181
testProp: 'testValue',
8282
oauth_predirect_instructions: [
8383
OAUTH_PREDIRECT_INSTRUCTION.ACCOUNT_AND_TRANSACTIONS_INSTRUCTION,
@@ -90,7 +90,7 @@ describe('<OAuthDefault /> PredirectInstructions test', () => {
9090
isOauthLoading: false,
9191
oauthURL: 'testUrl',
9292
selectedInstitution: {
93-
name: 'Wells Fargo',
93+
name: 'Any Bank',
9494
},
9595
},
9696
})
@@ -115,8 +115,8 @@ describe('<OAuthDefault /> PredirectInstructions test', () => {
115115
)
116116

117117
// See PredirectInstructions.tsx for the text we are verifying here
118-
expect(screen.getByText('Wells Fargo')).toBeInTheDocument()
119-
expect(screen.getByText('Log in at Wells Fargo', { selector: 'h2' })).toBeInTheDocument()
118+
expect(screen.getByText('Any Bank')).toBeInTheDocument()
119+
expect(screen.getByText('Log in at Any Bank', { selector: 'h2' })).toBeInTheDocument()
120120

121121
expect(
122122
screen.getByText((content, element) => {
@@ -138,7 +138,7 @@ describe('<OAuthDefault /> PredirectInstructions test', () => {
138138

139139
const institution = {
140140
guid: 'INS-test',
141-
name: 'Test Bank',
141+
name: 'Any Bank',
142142
oauth_predirect_instructions: [
143143
OAUTH_PREDIRECT_INSTRUCTION.ACCOUNT_AND_TRANSACTIONS_INSTRUCTION,
144144
OAUTH_PREDIRECT_INSTRUCTION.PROFILE_INFORMATION_INSTRUCTION,
@@ -152,7 +152,7 @@ describe('<OAuthDefault /> PredirectInstructions test', () => {
152152
isOauthLoading: false,
153153
oauthURL: 'testUrl',
154154
selectedInstitution: {
155-
name: 'Test Bank',
155+
name: 'Any Bank',
156156
},
157157
},
158158
})
@@ -177,10 +177,10 @@ describe('<OAuthDefault /> PredirectInstructions test', () => {
177177
)
178178

179179
// See PredirectInstructions.tsx for the text we are verifying here
180-
const exampleWindowHeader = screen.getByText('Test Bank').closest('.institution-panel-header')
180+
const exampleWindowHeader = screen.getByText('Any Bank').closest('.institution-panel-header')
181181
expect(exampleWindowHeader).toBeInTheDocument()
182182
expect(exampleWindowHeader).toHaveStyle({ backgroundColor: DEFAULT_HEADER_HEX_COLOR })
183-
expect(screen.getByText('Log in at Test Bank', { selector: 'h2' })).toBeInTheDocument()
183+
expect(screen.getByText('Log in at Any Bank', { selector: 'h2' })).toBeInTheDocument()
184184

185185
expect(
186186
screen.getByText((content, element) => {

src/views/oauth/experiments/__tests__/predirectInstructionUtils-test.ts

Lines changed: 6 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,23 @@
11
import { describe, it, expect } from 'vitest'
2-
import {
3-
isWellsFargoInstitution,
4-
getInstitutionBrandColor,
5-
} from 'src/views/oauth/experiments/predirectInstructionsUtils'
2+
import { getInstitutionBrandColor } from 'src/views/oauth/experiments/predirectInstructionsUtils'
63

74
describe('predirectInstructionsUtils', () => {
8-
describe('isWellsFargoInstitution', () => {
9-
it('returns true for Wells Fargo PROD guid', () => {
10-
const institution = {
11-
guid: 'INS-6073ad01-da9e-f6ba-dfdf-5f1500d8e867',
12-
} as InstitutionResponseType
13-
14-
expect(isWellsFargoInstitution(institution)).toBe(true)
15-
})
16-
17-
it('returns true for Wells Fargo SAND guid', () => {
18-
const institution = {
19-
guid: 'INS-f9e8d5f6-b953-da63-32e4-6e88fbe8b250',
20-
} as InstitutionResponseType
21-
22-
expect(isWellsFargoInstitution(institution)).toBe(true)
23-
})
24-
25-
it('returns true for institution name Wells Fargo', () => {
26-
const institution = {
27-
guid: 'INS-other-guid',
28-
name: 'Wells Fargo',
29-
} as InstitutionResponseType
30-
31-
expect(isWellsFargoInstitution(institution)).toBe(true)
32-
})
33-
34-
it('returns false for non-Wells Fargo institution', () => {
35-
const institution = {
36-
guid: 'INS-other-guid',
37-
name: 'Chase Bank',
38-
} as InstitutionResponseType
39-
40-
expect(isWellsFargoInstitution(institution)).toBe(false)
41-
})
42-
})
43-
445
describe('getInstitutionBrandColor', () => {
45-
it('returns configured color for Wells Fargo when brand_color_hex_code exists', () => {
6+
it('returns configured color for the INS when brand_color_hex_code exists', () => {
467
const institution = {
47-
guid: 'INS-6073ad01-da9e-f6ba-dfdf-5f1500d8e867',
8+
guid: 'INS-test',
489
brand_color_hex_code: '#D71E28',
4910
} as InstitutionResponseType
5011

5112
expect(getInstitutionBrandColor(institution, '#000000')).toBe('#D71E28')
5213
})
5314

54-
it('returns Wells Fargo red when brand_color_hex_code is missing', () => {
15+
it('returns the provided default color when brand_color_hex_code is missing', () => {
5516
const institution = {
56-
guid: 'INS-6073ad01-da9e-f6ba-dfdf-5f1500d8e867',
57-
} as InstitutionResponseType
58-
59-
expect(getInstitutionBrandColor(institution, '#000000')).toBe('#B22222')
60-
})
61-
62-
it('returns configured color for non-Wells Fargo institution', () => {
63-
const institution = {
64-
guid: 'INS-other-guid',
65-
name: 'Chase Bank',
66-
brand_color_hex_code: '#117ACA',
67-
} as InstitutionResponseType
68-
69-
expect(getInstitutionBrandColor(institution, '#000000')).toBe('#117ACA')
70-
})
71-
72-
it('returns default color when brand_color_hex_code is missing for non-Wells Fargo', () => {
73-
const institution = {
74-
guid: 'INS-other-guid',
75-
name: 'Chase Bank',
17+
guid: 'INS-test',
7618
} as InstitutionResponseType
7719

78-
expect(getInstitutionBrandColor(institution, '#AABBCC')).toBe('#AABBCC')
20+
expect(getInstitutionBrandColor(institution, '#000000')).toBe('#000000')
7921
})
8022

8123
it('brand_color_hex_code: validates hex color format with 6 digits', () => {

src/views/oauth/experiments/predirectInstructionsUtils.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
export function isWellsFargoInstitution(institution: InstitutionResponseType): boolean {
2-
const wellsFargoGuids = [
3-
'INS-6073ad01-da9e-f6ba-dfdf-5f1500d8e867', // Wells Fargo PROD guid
4-
'INS-f9e8d5f6-b953-da63-32e4-6e88fbe8b250', // Wells Fargo SAND guid for testing
5-
]
6-
7-
return wellsFargoGuids.includes(institution.guid) || institution.name === 'Wells Fargo'
8-
}
9-
101
export function getInstitutionBrandColor(
112
institution: InstitutionResponseType,
123
defaultColor: string,
@@ -15,10 +6,6 @@ export function getInstitutionBrandColor(
156
const configuredInstitutionColor =
167
rawColor && /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(rawColor) ? rawColor : null
178

18-
if (isWellsFargoInstitution(institution)) {
19-
return configuredInstitutionColor || '#B22222' // Default Wells Fargo red
20-
}
21-
229
return configuredInstitutionColor || defaultColor
2310
}
2411

0 commit comments

Comments
 (0)