Skip to content

test(web): DepositWizard receipt txHash truncation and omission (#671) - #1260

Merged
vjuliaife merged 2 commits into
vjuliaife:mainfrom
prodbycorne:test/671-deposit-wizard-receipt
Oct 18, 2026
Merged

vjuliaife merged 2 commits into
vjuliaife:mainfrom
prodbycorne:test/671-deposit-wizard-receipt

Conversation

@prodbycorne

@prodbycorne prodbycorne commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds unit tests for the DepositWizard receipt step (apps/web/components/DepositWizard.tsx, the conditional txHash line). The receipt shows {txHash.slice(0, 16)}… ↗ when a hash is present and leaves the line out when it isn't.

Changes

New apps/web/components/__tests__/DepositWizard.receipt.test.tsx, in the same vitest + Testing Library style as the existing Nav.*.test.tsx component tests:

  • api.deposit is mocked through @/lib/api, including an ApiError stub because error-formatter imports it from the same module.
  • The guided tour is mocked out, since it opens automatically on a first visit.
  • Each test walks the real flow (Next → Confirm → Deposit) to the receipt.
Test Acceptance criterion
long txHash: link text is exactly the first 16 chars + … ↗, and the explorer href still uses the full hash only the first 16 characters plus an ellipsis render
the full hash (and even 17 chars of it) never appears in the receipt text the full txHash isn't rendered in the receipt DOM
txHash of undefined / null / '': no link, no … ↗, and setError isn't called with an error a falsy txHash omits the line without error
amount and bucket label (50 XLM deposited to reserve (auto-top-up pool)) render next to the truncated hash; api.deposit gets { amountStroops: '500000000', bucket: 'reserve' } amount and bucket label still render

Note on "not rendered anywhere": the explorer link's href contains the full hash by design, because it's what opens the transaction on stellar.expert. The test asserts on the receipt's text, and separately checks that the href is the full-hash explorer URL.

How this was verified

apps/web has no test runner configured: no vitest dependency, config or test script. That's an existing gap, and the existing Nav.*.test.tsx files are in the same position. npm install in this repo also fails on macOS/Linux because of a lockfile entry (@rollup/plugin-commonjs@28.0.1 is pinned to os: win32), so I didn't change the repo's dependencies here.

I ran the new file with a throwaway vitest 3.2.4 + jsdom + Testing Library setup pointed at apps/web (with the @/ alias):

  • 6/6 pass
  • Mutation check: changing the component to slice(0, 20) makes the 3 truncation tests fail (the omission tests still pass, as expected), so the assertions really test the truncation. The component change was reverted.

A follow-up should add vitest + jsdom + @testing-library/* to apps/web with a test script (and fix the win32-only lockfile entry), so these component tests run in CI.

Closes #671
Closes #670
Closes #668
Closes #669

…ife#671)

Asserts the receipt link text is the first 16 characters plus an ellipsis,
the explorer href still uses the full hash, and the full hash never
appears in the receipt text.
…aife#671)

Covers undefined, null and empty txHash (no link, no error), and checks the
amount and bucket label still render next to the truncated hash, with the
expected api.deposit arguments.
@vercel

vercel Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
tariff-shield-web Error Error Oct 18, 2026 2:57pm UTC

@drips-wave

drips-wave Bot commented Oct 18, 2026

Copy link
Copy Markdown

@prodbycorne Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@prodbycorne
prodbycorne force-pushed the test/671-deposit-wizard-receipt branch from 1cae90c to 2c80a6a Compare October 18, 2026 14:57
@vercel

vercel Bot commented Oct 18, 2026

Copy link
Copy Markdown

Deployment failed for project tariff-shield-web with the following error:

The `vercel.json` schema validation failed with the following message: should NOT have additional property `rootDirectory`

Learn More: https://vercel.com/docs/concepts/projects/project-configuration

@vjuliaife
vjuliaife merged commit 08a9649 into vjuliaife:main Oct 18, 2026
1 of 2 checks passed

This branch had an error being deployed

1 failed deployment
Preview — 2c80a6af Deployed Oct 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants