From 357b7426376258ffe5b61e17b9914d9ff9867afd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sun, 27 Sep 2026 00:14:32 +0200 Subject: [PATCH] test(sharing): follow the invite form's reset through the re-proof flow --- .../sharing-recoverable-errors.test.tsx | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/__tests__/sharing-recoverable-errors.test.tsx b/src/__tests__/sharing-recoverable-errors.test.tsx index 05e6618cf..67f84b3ff 100644 --- a/src/__tests__/sharing-recoverable-errors.test.tsx +++ b/src/__tests__/sharing-recoverable-errors.test.tsx @@ -345,18 +345,16 @@ describe("a refused invitation keeps what was typed", () => { it("clears the form only where the invitation actually went", () => { // A static render cannot press the button, so the claim is made about the - // code path instead: every field reset lives inside `onSuccess`. A reset - // that migrated into `onError` — or out of the callbacks entirely — would - // wipe a typed identifier and eight ticked sections on a failure the - // person is being asked to retry. - const start = INVITE_CARD.indexOf("onSuccess:"); - const split = INVITE_CARD.indexOf("onError:", start); - // The options object ends at the first ` },` after the error arm, so - // the slice stops at the mutation rather than running into the JSX below, - // where a `setNarrowed(false)` / `setNarrowed(true)` on a radio would - // satisfy the matcher for the wrong reason. The success reset returns the - // scope to unset (`null`), which the JSX never writes. - const end = INVITE_CARD.indexOf("\n },", split); + // code path instead: every field reset sits after the awaited invitation + // inside `try`, and none in the `catch`. A reset that migrated into the + // failure arm would wipe a typed identifier and eight ticked sections on + // a failure the person is being asked to retry. The failure arm ends at + // the end of the submit handler, before the JSX below, where a + // `setNarrowed(false)` on a radio would satisfy the matcher for the wrong + // reason. + const start = INVITE_CARD.indexOf("await recentProof.run("); + const split = INVITE_CARD.indexOf("} catch (err) {", start); + const end = INVITE_CARD.indexOf("\n };", split); const onSuccess = INVITE_CARD.slice(start, split); const onError = INVITE_CARD.slice(split, end);