Skip to content

Set up Vitest and add frontend unit tests #371

@ogazboiz

Description

@ogazboiz

Join our community: https://t.me/+DOylgFv1jyJlNzM0

Description

The frontend has no automated tests at all. The CI job lints and builds but never runs tests. Vitest with React Testing Library would catch regressions in utilities and components.

Test Cases Needed

  • frontend/src/utils/amount.ts: fromStroops, toStroops, formatRate, hasValidPrecision
  • useStreamEvents hook: connects, receives events, reconnects on disconnect
  • Livecounter: increments every second, stops when isPaused prop is true
  • StreamCreationWizard: recipient validation error, amount precision validation
  • TransactionTracker: all 7 state transitions render correctly
  • CancelConfirmModal: confirm and cancel callbacks fire correctly

Files

  • frontend/vitest.config.ts (create)
  • frontend/src/__tests__/ (create)

Acceptance Criteria

  • npm test runs in frontend
  • CI frontend job runs tests
  • amount.ts utilities at 90%+ coverage

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programfrontendFrontend related taskstestingTesting related tasks

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions