Skip to content

Add BankAccountForm component tests - #122

Open
devin-ai-integration[bot] wants to merge 1 commit into
developfrom
devin/1778506956-add-bankaccountform-component-tests
Open

devin-ai-integration[bot] wants to merge 1 commit into
developfrom
devin/1778506956-add-bankaccountform-component-tests

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented May 11, 2026

Copy link
Copy Markdown

Summary

Adds a new Cypress component test file src/components/BankAccountForm.cy.tsx covering the BankAccountForm component, following the pattern used in src/components/SignInForm.cy.tsx (cy.mount with MemoryRouter, callbacks stubbed via cy.stub()).

The suite has 7 tests covering:

  1. Renders all input fields and a disabled submit button (after fields are touched).
  2. Enables submit button when all fields are filled with valid values.
  3. bankName validation errors (min 5 chars, required).
  4. routingNumber validation errors (length 9, required).
  5. accountNumber validation errors (min 9, max 12, required).
  6. createBankAccount is called with the expected payload on submit.
  7. onboarding=true prevents navigation away from the form after submit.

All 7 tests pass locally with yarn cypress:run:component --spec src/components/BankAccountForm.cy.tsx.

Notes

  • Test 1 ("disabled submit button on render") interacts with the form before the disabled assertion because Formik 2.4.6 does not run validation on mount by default (validateOnMount is false), so isValid starts as true and the submit button is enabled on the very first render. The test focuses+blurs each empty field to trigger validation and confirm the button becomes disabled when required fields are empty. This preserves the spirit of the assertion (submit must be disabled when fields are invalid) without modifying the production component.
  • Inputs are targeted via the [data-test=bankaccount-*-input] selectors on the MUI TextField wrapper; clear/blur operations use .find("input") to drill into the underlying native input, mirroring the existing E2E pattern in cypress/tests/ui/bankaccounts.spec.ts.

Review & Testing Checklist for Human

  • Run yarn cypress:run:component --spec src/components/BankAccountForm.cy.tsx locally and confirm all 7 tests pass.
  • Confirm the deviation in Test 1 (focus+blur each field before asserting disabled) is acceptable, or request that validateOnMount={true} be added to BankAccountForm.tsx instead so the assertion can be made on mount with no interaction.
  • Spot-check the calledWith payload shape in Test 6 matches what downstream code expects from createBankAccount.

Link to Devin session: https://app.devin.ai/sessions/a26eddde9d9e4d04bee56dc75c8809f5
Requested by: @tanveejoshi-dev


Devin Review

Status Commit
⚪ Not started

Run Devin Review

💡 Connect your GitHub account to enable automatic code reviews.

Open in Devin Review (Staging)
Open in Devin Review

Co-Authored-By: Tanvee Joshi <tanvee.joshi@cognition.ai>
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants