# native-mend / ui-test — result **No live payment was made.** No transaction was sent, no RPC was called and no key was used. Every confirmation and report in these tests is simulated and offline. ## Outcome `web/tests/native-ui.test.mjs` now runs on the merged trunk. All 28 original cases pass, plus 1 new case (29 of 29). No assertion was weakened or removed. ## Files changed and why - **`web/tests/native-ui.test.mjs`** - **Plugin removed.** The esbuild plugin `native-peer-contracts` is gone. It sent `native/{client,orders,policy}` to fixtures and appended `export { fetchNativeReport }` to `src/swarm.ts`, which caused the duplicate-export error at `src/swarm.ts:789`. The bundle now uses the real `native/policy`, `native/orders`, `native/client`, `native/view`, `native/body` and `swarm` modules. - **Simulated answers.** These are still injected only through `trackNative`'s `read`, `fetchReport` and `saveJob` options, as before. The default `readNative` and `fetchNativeReport` are never called: every tracker the tests start passes `read` and `fetchReport`, and the `NativeResearch` renders use routes that have no transaction hash. - **In-memory `localStorage`.** The stub now supports `key()`, `length` and `removeItem`, because the real `native/orders.ts` lists stored records with them. Nothing is persisted. - **Seed data, one field added.** The first record in the "payer labels…" case now carries `requestId: REQUEST` alongside `jobId: JOB`. The real `saveNativeJob` and `nativeOrdersOf` keep a job mapping only when both values are present, so a mapping with only a job ID cannot occur in the real app. The assertions are unchanged. - **Typecheck case.** This case copied fixture stand-ins in when a peer module was missing. Its check for whether a peer already existed was broken: `\b` inside a template string becomes a backspace character, so it never matched. On the merged trunk that would have appended a second `fetchNativeReport` and `NativeCheckout` and failed tsc. All peers are now merged, so the case copies `src` as it is and still asserts that `tsc --noEmit` exits 0. - **New case: "the view reads a job body exactly as native/body.ts writes it".** - It builds a body with the real `nativeJobBody([game])`: a JSON envelope with `objective` and `outputs`. - It checks the envelope (objective, an output for `artifacts/report.json`) and that the event line sits inside the JSON objective. - It checks that `eventsOf` finds the event and `reportLangOf` returns `en`. - It renders `NativeStatus` with that body: the report shows (Report ready, Payment confirmed by IMD, the game, 62%, research, citation, opposing argument) and the raw JSON envelope does not. - With the same body and `paid: false`, nothing from the report renders. - **Catalogue rows.** Nothing is asserted about the total number of catalogue rows. The existing check compares only `NATIVE_ROWS[id].length` with `NATIVE_KEYS.length`, both inside `i18n-ui/native.ts`. - **`web/tests/fixtures/native-ui/orders.ts`** was an in-memory replacement for `native/orders`. It is now a small seeder that writes checkout attempts (`imd-picks:native-attempt:v1::`) and job mappings (`imd-picks:native-job:v1:`) into `localStorage` in the format the real module reads. The real module does the reading. - **Deleted `web/tests/fixtures/native-ui/{client.ts,policy.ts,report.ts,checkout.tsx}`.** These were stand-ins for peer modules that are now merged, and nothing references them any more. No package file, lockfile or build configuration was touched, and no dependency was added. Nothing here adds a site contract, an extra transfer or a backend signing key. ## Commands run (from `web/`, `TMPDIR=/test/scratch/tmp`) | Command | Exit | Result | |---|---|---| | `npm ci --no-audit --no-fund` | 0 | installed from the lockfile | | `node --test tests/native-ui.test.mjs` | 0 | 29 tests: 29 pass, 0 fail | | `npx tsc --noEmit` | 0 | no errors | | `node --test tests/*.test.mjs` | 0 | 175 tests: 175 pass, 0 fail | | `node scripts/i18n-check.mjs` | **1** | 605 strings checked in 9 languages; each of fr, es, ru, ja, zh, pt, it, th, pcm is missing 14 strings | | `npx vite build --outDir ../test/scratch/dist --emptyOutDir` | 0 | built; only the usual warning about chunk size | The full test glob ran 175 tests, not the 147 the brief mentions. Presumably the checkout already includes test files from other items or waves; all of them pass. ## Defects outside my scope (left unfixed) 1. **The i18n check fails on strings in `web/src/checkout.tsx`.** Examples: `checkout.tsx:180` "Research checkout", `:185` "Swarm research fee" and "Unavailable", `:189` "Earlier requests from this wallet", `:192` "Open request {x}". 14 strings are missing in each of the 9 non-English languages. - **Reproduce:** `cd web && node scripts/i18n-check.mjs` (exits 1). - This is presumably what the peer item's `web/src/i18n-ui/checkout.ts` catalogue will fix. 2. **Minor, not a failure: `reportLangOf` (`web/src/pages.tsx:304`) runs its regex on the raw body.** For the JSON bodies `native/body.ts` writes, it only works because the line breaks are escaped inside the JSON string. It does not read the objective through `objectiveOf`. - English is correct (covered by the new case). Other languages were not tested here. - **Reproduce:** `reportLangOf(nativeJobBody([game], "", "", "es"))` and compare with `"es"`. ## What remains unproven - The default production reader (`readNative`) and report fetch (`fetchNativeReport`) are bundled but never run here; these tests cover only the view and tracker logic against injected answers. - Nothing about the live IMD.fun Intake, the indexer, delivery over IPFS or an HTTP gateway, or wallet behaviour is tested here. - The full payment-to-report workflow has not been tested end to end, and no live payment was made.