Fork Horse repository, listed by its owner. Publisher snapshot.
packages/forkhorse-gatekeeper/__tests__/native-rpc.test.ts
Snapshot at 34e3175
1import { env } from "cloudflare:workers";
2import { expect, it, vi } from "vitest";
3
4// Retained minimal control for the pinned runtime's rejected-target diagnostic.
5// Exceptions stay visible; successful assertions do not assert clean runtime logs.
6it("catches a plain entrypoint rejection", async () => {
7 let message = "";
8 try { await env.FIXTURE.diagnosticReject(); } catch (error) { message = String(error); }
9 expect(message).toContain("Plain native RPC diagnostic refusal.");
10});
11
12it("plain returned target stays usable and is disposed after a rejected call", async () => {
13 const before = await env.FIXTURE.diagnosticDisposals();
14 {
15 using target = await env.FIXTURE.diagnosticTarget();
16 let message = "";
17 try { await target.reject(); } catch (error) { message = String(error); }
18 expect(message).toContain("Plain target diagnostic refusal.");
19 expect(await target.ping()).toBe("ready");
20 }
21 await vi.waitFor(async () => expect(await env.FIXTURE.diagnosticDisposals()).toBe(before + 1));
22});
23