test(frontend): SwapPage fee-discount registry outage banner visibility (#374) #896

Merged
Brouie merged 1 commit from qa/374-swappage-registry-banner-test into main 2026-06-13 03:42:12 +00:00
Brouie commented 2026-06-13 03:40:03 +00:00 (Migrated from gitlab.com)

Adds the page-level banner-visibility coverage #374 AC5 calls for. The util matrix was already tested in feeDiscountRegistryWarning.test.ts, but no SwapPage test asserted the banner actually renders — existing SwapPage tests pin getFeeDiscountHealth to ok:true, so the amber banner never showed.

New file SwapPage.feeDiscountRegistryBanner.test.tsx (4 cases), isolated so it doesn't change SwapPage.test.tsx behavior:

  • registered trader + indexer fee_discount_registry_ok:false → banner visible, Swap submit stays enabled (non-blocking).
  • registered trader + get_registration LCD query error → banner visible.
  • registered trader + healthy registry → no banner.
  • unregistered trader + healthy registry → no banner.

The fee-discount queries gate on FEE_DISCOUNT_CONTRACT_ADDRESS, which is empty in the test env, so the file mocks @/utils/constants truthy (scoped to this file; the existing 13 SwapPage tests are unaffected — verified green).

Test-only change. tsc -b clean. New file 4/4 green; SwapPage.test.tsx 13/13 unchanged.

Leaves only the browser walkthrough for #374 (laptop).

Adds the page-level banner-visibility coverage #374 AC5 calls for. The util matrix was already tested in `feeDiscountRegistryWarning.test.ts`, but no SwapPage test asserted the banner actually renders — existing SwapPage tests pin `getFeeDiscountHealth` to `ok:true`, so the amber banner never showed. New file `SwapPage.feeDiscountRegistryBanner.test.tsx` (4 cases), isolated so it doesn't change `SwapPage.test.tsx` behavior: - registered trader + indexer `fee_discount_registry_ok:false` → banner visible, Swap submit stays enabled (non-blocking). - registered trader + `get_registration` LCD query error → banner visible. - registered trader + healthy registry → no banner. - unregistered trader + healthy registry → no banner. The fee-discount queries gate on `FEE_DISCOUNT_CONTRACT_ADDRESS`, which is empty in the test env, so the file mocks `@/utils/constants` truthy (scoped to this file; the existing 13 SwapPage tests are unaffected — verified green). Test-only change. `tsc -b` clean. New file 4/4 green; `SwapPage.test.tsx` 13/13 unchanged. Leaves only the browser walkthrough for #374 (laptop).
Brouie commented 2026-06-13 03:40:16 +00:00 (Migrated from gitlab.com)

mentioned in issue #374

mentioned in issue #374
PlasticDigits commented 2026-06-13 03:41:45 +00:00 (Migrated from gitlab.com)

Security review

Commit reviewed: d7dcfe81e75d75e0037a89020b37cfacdcd85aa8
Scope: Added file frontend-dapp/src/pages/SwapPage.feeDiscountRegistryBanner.test.tsx only (4 Vitest cases for fee-discount registry outage banner visibility on SwapPage). No production/runtime code changes in this diff.

Method: Inspected full MR diff; traced exercised paths (shouldShowFeeDiscountRegistryWarning, static FEE_DISCOUNT_REGISTRY_WARNING_TEXT render, indexer getFeeDiscountHealth / LCD getRegistration mocks). Checked for injection, authz, secret leakage, SSRF/XSS, unsafe deserialization, and new dependency surface. No prior security-review threads on this MR.

Outcome: FINDINGS: 0 medium+

Security review: no medium+ findings on this diff.

Rationale (summary):

  • Test-only change: vi.mock / spies are confined to Vitest; they do not ship in the production bundle or alter runtime constants.
  • Banner text is a compile-time constant rendered as React text (no dangerouslySetInnerHTML, no attacker-controlled sink).
  • Mocks use synthetic Terra addresses; no credentials or live endpoints introduced.
  • Asserting Swap stays enabled during a registry outage documents existing intentional non-blocking UX (#365/#374); not a new permission boundary or auth change in this MR.

Inline threads: none (no findings to anchor).

## Security review **Commit reviewed:** `d7dcfe81e75d75e0037a89020b37cfacdcd85aa8` **Scope:** Added file `frontend-dapp/src/pages/SwapPage.feeDiscountRegistryBanner.test.tsx` only (4 Vitest cases for fee-discount registry outage banner visibility on SwapPage). No production/runtime code changes in this diff. **Method:** Inspected full MR diff; traced exercised paths (`shouldShowFeeDiscountRegistryWarning`, static `FEE_DISCOUNT_REGISTRY_WARNING_TEXT` render, indexer `getFeeDiscountHealth` / LCD `getRegistration` mocks). Checked for injection, authz, secret leakage, SSRF/XSS, unsafe deserialization, and new dependency surface. No prior security-review threads on this MR. **Outcome:** `FINDINGS: 0` medium+ Security review: **no medium+ findings** on this diff. **Rationale (summary):** - Test-only change: `vi.mock` / spies are confined to Vitest; they do not ship in the production bundle or alter runtime constants. - Banner text is a compile-time constant rendered as React text (no `dangerouslySetInnerHTML`, no attacker-controlled sink). - Mocks use synthetic Terra addresses; no credentials or live endpoints introduced. - Asserting Swap stays enabled during a registry outage documents existing intentional non-blocking UX (#365/#374); not a new permission boundary or auth change in this MR. **Inline threads:** none (no findings to anchor).
PlasticDigits (Migrated from gitlab.com) merged commit d013b611ab into main 2026-06-13 03:42:12 +00:00
PlasticDigits commented 2026-06-13 03:42:13 +00:00 (Migrated from gitlab.com)

mentioned in commit d013b611ab

mentioned in commit d013b611ab3b5407b7ce677f4b2ace4824f677ea
PlasticDigits commented 2026-06-13 04:20:43 +00:00 (Migrated from gitlab.com)

mentioned in commit 17453e7a49

mentioned in commit 17453e7a49135a24b5a5b1527b98d99eddbd3961
PlasticDigits commented 2026-06-13 04:21:01 +00:00 (Migrated from gitlab.com)

mentioned in merge request !899

mentioned in merge request !899
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic!896
No description provided.