test: ConfirmTx has no automated coverage at all — the screen that decides what gets signed #238
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
src/popup/views/confirmTx.jshas no unit tests, andmake test-e2enever reaches the confirmation screen. So the screen where the user decides whether to sign a transaction has zero automated coverage of its own behaviour.Established during the third review of #197, which had to verify the change by reading the code and by driving a browser by hand. The reviewer's exact observation: a mutant that made the spend gate read the DISPLAY estimate instead of the reserve — reintroducing #154 in full — would NOT be caught by the test suite. It is correct today by reading, not by test.
The pure arithmetic underneath is well covered:
src/shared/txValidation.jshas 29 tests and seven mutants that all die. The gap is the wiring — which value is passed to the gate, when validation re-runs, what the fee block renders, and whether the Send button is enabled.Same class as #229 (Settings has no browser coverage), and worse in consequence: Settings breaking is visible and annoying, ConfirmTx being wrong is invisible and expensive.
Implementation requirements
Definition of done
make test-e2edrives ConfirmTx for both the ETH and ERC-20 paths.TODO.mdupdated in the same commit.make checkpasses.Done in #258, base
next.The e2e harness gained a funded-balance fixture (
ethBalanceWei,seedTokenBalance), alatestblock carryingbaseFeePerGas— without itethers has no
maxFeePerGasand the reserve and the estimate collapse into onenumber, which would make the gate tests vacuous —
decimals()for the stubtoken on
eth_call, a refusableeth_estimateGas(failGasEstimate), and aholdable one (
holdGasEstimate) so the pending state is observed rather thanraced. Nine tests over both the ETH and the ERC-20 path: pending, funded,
over-balance, estimate-failed, both fee numbers rendered, and view height
constant across every transition (1022.5625px ETH, 1070.5625px ERC-20, printed
on every run).
The gate assertion is demonstrated, not inspected. Changing
feeWei = gasCostWeitofeeWei = estimateWeiinestimateGas()— the mutant from thethird review of #197 — turns
the suite red:
The mutation was reverted; the branch touches nothing under
src/.Verified:
make checkgreen (19 suites, 416 tests, prettier clean),make test-e2egreen at 23/23, both re-run after rebasing ontonextatbd4bdca.