Web tests: cover personal payer-transfer invitation submission failures

Open
#705 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
react, typescript
Domain
testing

Research direction

Start with web/src/__tests__/PayerTransferJourneys.test.tsx for the existing form fixtures, mocked API, and successful invitation cases; then read web/src/PayerTransferStart.tsx to follow quote and request-key handling. Add component tests using visible controls and deferred beginPayerTransfer promises for temporary failures, retries, and 409 conflicts. Done means the acceptance criteria pass with cd web && npm test -- src/__tests__/PayerTransferJourneys.test.tsx.

Written by the indexing model from the issue text.

Description

good first issue help wanted test-coverage

The problem

The personal payer-transfer form has two distinct recovery paths when sending an invitation fails:

  • A temporary failure retains the reviewed quote and request key for an explicit retry.
  • A 409 conflict discards that quote and key, requiring the user to review fresh terms.

The journey suite covers successful invitation creation but does not reject beginPayerTransfer to exercise either path. Add component coverage so retrying a request keeps its identity and a conflict cannot reuse outdated terms.

This is a test-coverage task, not a report of a reproduced production defect.

Evidence

Inspected main de5a0e477ff70ff8dcd2493ce2d9dcb4e90fd757:

Ran cd web && npm test -- src/__tests__/PayerTransferJourneys.test.tsx: all 19 tests passed on macOS arm64, Node 24.15.0, Vitest 5.0.5 / happy-dom. No live billing requests or native-browser journey were run. Open/closed issues and open PRs were checked for overlap.

Proposed approach

Extend the existing tests for Change who pays (PersonalTransferStart). Drive the organisation/admin selectors, review a quote and submit using the visible controls. Use deferred API promises and compare the arguments of successive beginPayerTransfer calls, without accessing component internals.

Acceptance criteria

  • While sending is pending, the send control is disabled and repeated activation does not create a second request.
  • Reject the first send with a temporary error. Assert visible error feedback, no success notice, the reviewed quote remains available and the controls recover. No automatic retry occurs.
  • Retry explicitly while the quote remains valid. Assert that the retry uses the same quote and request key. Resolve it successfully and verify the error clears and the existing successful-request notice appears.
  • In a separate case, reject the send with the API's server error (409) shape. Assert that the stale quote's send control disappears and the user can request a fresh quote.
  • After reviewing a different fresh quote and sending again, assert that both the quote and request key differ from the conflicted attempt. Merely requesting that fresh quote must not send an invitation automatically.
  • Use synthetic data and controlled promises; restore any spies or clocks. Keep quotes unexpired so these tests isolate request failure from expiry handling.
  • Run cd web && npm test -- src/__tests__/PayerTransferJourneys.test.tsx and record the result in the PR.

Scope

One form's component tests, using the existing mocks. No changes to billing rules or API contracts are required. This is suitable for a first contribution with React Testing Library familiarity.

#647 covers accepting an invitation already in the inbox, #637 covers administrator loading, and #690 covers quote expiry. This task covers sending the initial personal-to-organisation invitation and recovering from its API failure.

Follow CONTRIBUTING.md, including British English and DCO sign-off with git commit -s.

Dominant language
Rust
Stars
31
Forks
42
Avg merge
2d 18h
Merged PRs (30d)
142

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from getsotto/sotto

All issues in getsotto/sotto

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.