diff --git a/tests/unit/browser-rpc/browser-rpc-remediation.test.ts b/tests/unit/browser-rpc/browser-rpc-remediation.test.ts index dcd9ded..fa10e33 100644 --- a/tests/unit/browser-rpc/browser-rpc-remediation.test.ts +++ b/tests/unit/browser-rpc/browser-rpc-remediation.test.ts @@ -645,10 +645,17 @@ describe("RPC-01 only a positive receipt confirms physical closure", () => { ); expect(results).toHaveLength(1); - expect(results[0]).toMatchObject({ - ok: false, - error: { code: "RPC_TOTAL_DEADLINE_EXCEEDED" }, - }); + // The subject is that a throwing accessor cannot replace the outcome the + // runtime already selected, not which deadline won. `totalDeadlineMs` and + // `idleDeadlineMs` are deliberately equal here, so pinning one of the two + // timeout codes would make this assertion a coin flip under load. + expect(results[0]).toMatchObject({ ok: false }); + const failure = results[0] as { error: { kind: string; code: string } }; + expect(failure.error.kind).toBe("REQUEST_TIMEOUT"); + expect([ + "RPC_TOTAL_DEADLINE_EXCEEDED", + "RPC_STREAM_IDLE_TIMEOUT", + ]).toContain(failure.error.code); expect(cancels).toHaveLength(1); });