Repository navigation
Open
Labels
Description
Priority
Low — nice to have, can wait
User story / Problem statement
The console's tests fake the contract clients by hand, and the largest component is too big to review. Once CI generates the contract clients before the JavaScript checks, the tests can use the real client types to catch drift.
As a developer changing a contract or the console, I want test fakes that fail the type check when they no longer match the contract, and components small enough to review.
Problems
- 37 test files mock
config/clientswith hand-built objects ({ current_epoch: vi.fn() }). A renamed method, a changed argument or a changed result shape still passes them. - Some fixtures no longer match the contracts: enum values without
values, pending changes without their types, holder arguments narrower than the client's, and vault roles faked asundefinedwhere the client returnsnull. -
app/src/components/vault/TransactionModal.tsxis 2,158 lines and holds the copy and status text for about 16 actions. Its test,TransactionModal.test.tsx, is 3,300 lines.
Expected outcome
- One shared, typed fake. A single test helper, typed with the generated client APIs, replaces the per-file client mocks. Each test names only the calls it uses. A wrong call name, argument or result shape fails the type check, and a faked read must carry its result.
- Split
TransactionModaland its test. The component splits by section (investor, cycle, emergency, configuration, governance, compliance) behind a small shell, and its test splits the same way with shared render helpers. Same rendered output, same props for callers, same test names and assertions.
Acceptance criteria
- No test file mocks
config/clientswith a hand-built object; one typed helper builds the fakes - A faked call with a wrong name, argument or result type fails
npm run typecheck -
TransactionModal.tsxandTransactionModal.test.tsxare split into section files, and no file in the split is over 1,000 lines - The number of tests does not drop, and every existing test name still runs
Technical notes
A working version of both parts is in the history of #421 and can be reused:
- Shared typed fake: c9c75ec (helper and the 37 migrations, with the fixture fixes) and 908a78b (a faked read must carry its result).
TransactionModalsplit: 80acc8e (component), d1d371b (tests) and df89ed1 (render helpers underapp/src/test/).
#421 reverted them to keep that pull request to the CI change. They were written against that branch, so expect conflicts with later changes to the same files.
Activity