diff --git a/TODO.md b/TODO.md index 8021497..0de9823 100644 --- a/TODO.md +++ b/TODO.md @@ -45,6 +45,16 @@ but the review is broader than any of them. # Completed Steps +- 2026-10-04: A popup boot in the tests loads transactions without failing + ([#429](https://git.eeqj.de/sneak/AutistMask/issues/429)). The stand-in for + `filterTransactions` in `tests/support/popupBoot.js` returned a bare list, + while the real one returns `{ transactions, newFraudContracts }`, so every + boot onto Home, AddressDetail or AddressToken failed inside its transaction + loading and logged `loadHomeTxs failed` or `loadTransactions failed`; the rest + of that code never ran. The stand-in now returns the real shape, and + `tests/persistedFieldContract.test.js` boots onto each of the three and + asserts neither message is logged. `make test` time did not change measurably. + - 2026-10-04: The native token's label follows the network ([#372](https://git.eeqj.de/sneak/AutistMask/issues/372)). `networks.js` gives each network a `nativeCurrency` and nothing read it: every screen wrote `ETH`, diff --git a/tests/persistedFieldContract.test.js b/tests/persistedFieldContract.test.js index 34f45d2..091c35b 100644 --- a/tests/persistedFieldContract.test.js +++ b/tests/persistedFieldContract.test.js @@ -722,6 +722,28 @@ describe("the base profile the sweep corrupts", () => { } }); +// Home, AddressDetail and AddressToken load their transactions inside a catch +// that only logs, so a boot that fails there still renders the view and passes +// the tests above while none of that code runs. +describe("the base profile loads transactions", () => { + for (const view of ["main", "address", "address-token"]) { + test(`on ${view} without logging a failure`, async () => { + const consoleError = jest.spyOn(console, "error"); + try { + await bootPopup(restoringOnto(view)); + const failures = consoleError.mock.calls + .map((args) => args.join(" ")) + .filter((line) => + /loadHomeTxs failed|loadTransactions failed/.test(line), + ); + expect(failures).toEqual([]); + } finally { + consoleError.mockRestore(); + } + }); + } +}); + // A field the ROUTER itself reads — the two it gates on and the two // hasValidAddress() indexes with. A hostile value in one of these legitimately // changes which view renders, so each gets its own boot per view and is held diff --git a/tests/support/popupBoot.js b/tests/support/popupBoot.js index 20d4a76..5f76bd8 100644 --- a/tests/support/popupBoot.js +++ b/tests/support/popupBoot.js @@ -263,9 +263,12 @@ async function bootPopup(stored, options) { getProvider: () => ({}), scanForAddresses: jest.fn(async () => []), })); + // filterTransactions() answers in the real one's shape: Home, + // AddressDetail and AddressToken read both fields, and a bare list makes + // their transaction loading throw into a catch that only logs. jest.doMock("../../src/shared/transactions", () => ({ fetchRecentTransactions: jest.fn(async () => []), - filterTransactions: () => [], + filterTransactions: () => ({ transactions: [], newFraudContracts: [] }), })); const storage =