Repository navigation
Fix NaN bankAccountID in VBBA flow after verify-account resume #85733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
NikkiWines
merged 14 commits into
Expensify:main
from
c3024:vbba-verified-bankaccountid-main-only
Mar 20, 2026
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
0fd0e34
Align verified-account resume with clean bank setup state.
c3024 55d0181
Add DEFAULT_NUMBER_ID fallback for bankAccountID in reimbursement com…
MelvinBot 5076cbe
Add eslint-disable comments for pre-existing deprecation warnings
MelvinBot 10bc9a0
Fix react-hooks/set-state-in-effect lint and prettier formatting
MelvinBot 8eccdae
Merge remote-tracking branch 'origin/main' into vbba-verified-bankacc…
MelvinBot f0b7b8d
Add unit tests for non-finite bankAccountID in VBBA connect actions
c3024 913209c
Drop non-realistic Infinity cases from BankAccountsTest
c3024 2c36412
Merge branch 'main' into vbba-verified-bankaccountid-main-only
c3024 9d303e8
Use !Number.isNaN for bankAccountID in VBBA connect actions
c3024 0c70f7d
Add getBankAccountIDAsNumber helper for USD VBBA flow
c3024 c28dcf1
cleanup comment
c3024 b82b7b6
cleanup comment
c3024 832aaea
Suppress no-deprecated for useSubStep in BusinessInfo and BeneficialO…
c3024 d4b1e33
Fix useSubStep eslint-disable placement for CI
c3024 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import {write} from '@libs/API'; | ||
| import {WRITE_COMMANDS} from '@libs/API/types'; | ||
| import {connectBankAccountManually, connectBankAccountWithPlaid} from '@userActions/BankAccounts'; | ||
| import CONST from '@src/CONST'; | ||
| import type PlaidBankAccount from '@src/types/onyx/PlaidBankAccount'; | ||
|
|
||
| jest.mock('@libs/API'); | ||
|
|
||
| const mockWrite = jest.mocked(write); | ||
|
|
||
| const policyID = 'policy123'; | ||
|
|
||
| const selectedPlaidBankAccount: PlaidBankAccount = { | ||
| accountNumber: '123456789', | ||
| plaidAccountID: 'plaid-account-id', | ||
| routingNumber: '021000021', | ||
| mask: '6789', | ||
| plaidAccessToken: 'plaid-access-token', | ||
| bankName: 'Test Bank', | ||
| isSavings: false, | ||
| }; | ||
|
|
||
| describe('BankAccounts', () => { | ||
| beforeEach(() => { | ||
| jest.clearAllMocks(); | ||
| }); | ||
|
|
||
| describe('connectBankAccountWithPlaid', () => { | ||
| test('sends DEFAULT_NUMBER_ID when bankAccountID is NaN', () => { | ||
| // Given NaN for bankAccountID from the VBBA flow (e.g. undefined achData.bankAccountID) | ||
| // When connecting with Plaid | ||
| connectBankAccountWithPlaid(Number.NaN, selectedPlaidBankAccount, policyID); | ||
|
|
||
| // Then the API payload must not contain NaN | ||
| expect(mockWrite).toHaveBeenCalledWith(WRITE_COMMANDS.CONNECT_BANK_ACCOUNT_WITH_PLAID, expect.objectContaining({bankAccountID: CONST.DEFAULT_NUMBER_ID}), expect.anything()); | ||
| }); | ||
|
|
||
| test('passes through finite bankAccountID unchanged', () => { | ||
| const existingID = 4242; | ||
| connectBankAccountWithPlaid(existingID, selectedPlaidBankAccount, policyID); | ||
|
|
||
| expect(mockWrite).toHaveBeenCalledWith(WRITE_COMMANDS.CONNECT_BANK_ACCOUNT_WITH_PLAID, expect.objectContaining({bankAccountID: existingID}), expect.anything()); | ||
| }); | ||
| }); | ||
|
|
||
| describe('connectBankAccountManually', () => { | ||
| test('sends DEFAULT_NUMBER_ID when bankAccountID is NaN', () => { | ||
| connectBankAccountManually(Number.NaN, selectedPlaidBankAccount, policyID); | ||
|
|
||
| expect(mockWrite).toHaveBeenCalledWith(WRITE_COMMANDS.CONNECT_BANK_ACCOUNT_MANUALLY, expect.objectContaining({bankAccountID: CONST.DEFAULT_NUMBER_ID}), expect.anything()); | ||
| }); | ||
|
|
||
| test('passes through finite bankAccountID unchanged', () => { | ||
| const existingID = 99; | ||
| connectBankAccountManually(existingID, selectedPlaidBankAccount, policyID); | ||
|
|
||
| expect(mockWrite).toHaveBeenCalledWith(WRITE_COMMANDS.CONNECT_BANK_ACCOUNT_MANUALLY, expect.objectContaining({bankAccountID: existingID}), expect.anything()); | ||
| }); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.