Skip to content

Commit d3dd362

Browse files
test(client-runtime): fallback ticket test asserts the proofs that bind the request
Co-Authored-By: Claude Fable 5.1 <[email protected]>
1 parent 68f0ecc commit d3dd362

1 file changed

Lines changed: 19 additions & 5 deletions

File tree

‎packages/client-runtime/src/authorization/remote.test.ts‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,12 +292,26 @@ describe("remote environment authorization", () => {
292292
"https://remote.example.com/api/auth/websocket-ticket/rpc",
293293
"https://remote.example.com/api/auth/websocket-ticket",
294294
]);
295-
expect(proofs.map((proof) => proof.url)).toEqual([
296-
"https://remote.example.com/api/auth/websocket-ticket/rpc",
297-
"https://remote.example.com/api/auth/websocket-ticket",
298-
"https://remote.example.com/ws",
295+
expect(proofs).toEqual([
296+
{
297+
method: "POST",
298+
url: "https://remote.example.com/api/auth/websocket-ticket/rpc",
299+
accessToken: "dpop-access-token",
300+
},
301+
{
302+
method: "POST",
303+
url: "https://remote.example.com/api/auth/websocket-ticket",
304+
accessToken: "dpop-access-token",
305+
},
306+
{ method: "GET", url: "https://remote.example.com/ws", accessToken: "old-ticket" },
299307
]);
300-
expect(url).toContain("wsTicket=old-ticket");
308+
expectFetchCall(fetch.calls, 2, {
309+
url: "https://remote.example.com/api/auth/websocket-ticket",
310+
method: "POST",
311+
headers: { dpop: "proof-2" },
312+
});
313+
expect(new URL(url).searchParams.get("wsTicket")).toBe("old-ticket");
314+
expect(new URL(url).searchParams.get("dpop")).toBe("proof-3");
301315
}),
302316
);
303317

0 commit comments

Comments
 (0)