test(frontend): add missing enrich export to SwapPage preflight mock (2 red tests on main) #864

Merged
Brouie merged 1 commit from qa/337-swappage-preflight-mock into main 2026-06-11 05:43:11 +00:00
Brouie commented 2026-06-11 02:14:22 +00:00 (Migrated from gitlab.com)

SwapPage.test.tsx has 2 deterministically red tests on main: the #293 expert-mode slippage block and the #329 fallback-label test.

Root cause (bisected): 76723cf (#341 preflight fix, merged in a6c43ca) added an enrichSwapOperationsWithHopMinReturns call to the quote path, but the suite's vi.mock factory for swapRoutePreflight only exports preflightSwapRouteSpread. Under the mock the function is undefined, the call throws inside the try, gets caught as an indexer failure, and the quote path dies — #293's test never gets a quote ("Quote unavailable"), #329's falls through to client BFS and renders the fallback label it asserts absent.

Test-bug only — no product regression; the real function on the live path is fine (#341 behavior verified separately).

Fix: export a typed passthrough mock (async (operations: SwapOperation[]) => operations). SwapPage.test.tsx runs 11/11 with it; eslint clean.

Found during the #337 sweep — details in the note there. Companion MR fixes the tsc -b break from the same sweep.

SwapPage.test.tsx has 2 deterministically red tests on main: the #293 expert-mode slippage block and the #329 fallback-label test. Root cause (bisected): 76723cf (#341 preflight fix, merged in a6c43ca) added an enrichSwapOperationsWithHopMinReturns call to the quote path, but the suite's vi.mock factory for swapRoutePreflight only exports preflightSwapRouteSpread. Under the mock the function is undefined, the call throws inside the try, gets caught as an indexer failure, and the quote path dies — #293's test never gets a quote ("Quote unavailable"), #329's falls through to client BFS and renders the fallback label it asserts absent. Test-bug only — no product regression; the real function on the live path is fine (#341 behavior verified separately). Fix: export a typed passthrough mock (async (operations: SwapOperation[]) => operations). SwapPage.test.tsx runs 11/11 with it; eslint clean. Found during the #337 sweep — details in the note there. Companion MR fixes the tsc -b break from the same sweep.
Brouie commented 2026-06-11 04:58:09 +00:00 (Migrated from gitlab.com)

mentioned in issue #337

mentioned in issue #337
PlasticDigits commented 2026-06-11 05:43:10 +00:00 (Migrated from gitlab.com)

mentioned in commit 4e125ef102

mentioned in commit 4e125ef10266f708513da31073a5be8cbe9c9429
PlasticDigits (Migrated from gitlab.com) merged commit 4e125ef102 into main 2026-06-11 05:43:11 +00:00
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!864
No description provided.