Skip to content

Commit 6176265

Browse files
committed
test(gateway): chat.send pending-profile dispatch carries its required session target
chat.send requires a non-empty sessionKey at the protocol level; the mutation pipeline now rejects targetless frames before profile-dependent dispatch, so the pending-profile test must send a realistic frame.
1 parent 703308a commit 6176265

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

‎src/gateway/server-methods.profile-authorization.test.ts‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ async function dispatchPendingProfileMethod(params: {
3636
respond,
3737
client: params.client,
3838
isWebchatConnect: () => false,
39-
context: { logGateway: { warn: vi.fn() } } as unknown as Parameters<
40-
typeof handleGatewayRequest
41-
>[0]["context"],
39+
context: {
40+
logGateway: { warn: vi.fn() },
41+
getRuntimeConfig: () => ({}),
42+
} as unknown as Parameters<typeof handleGatewayRequest>[0]["context"],
4243
...(params.methodRegistry
4344
? { methodRegistry: params.methodRegistry }
4445
: { extraHandlers: { [params.method]: params.handler } }),
@@ -53,7 +54,14 @@ describe("Gateway pending-profile authorization", () => {
5354
client.authenticatedGitHubIdentitySync = vi.fn(async () => await deferred.promise);
5455
const handler = vi.fn<GatewayRequestHandler>(({ respond }) => respond(true, { ok: true }));
5556

56-
const request = dispatchPendingProfileMethod({ client, handler, method: "chat.send" });
57+
const request = dispatchPendingProfileMethod({
58+
client,
59+
handler,
60+
method: "chat.send",
61+
// chat.send requires a session target at the protocol level; the mutation
62+
// pipeline rejects targetless frames before profile-dependent dispatch.
63+
requestParams: { sessionKey: "agent:main:main" },
64+
});
5765
await Promise.resolve();
5866
expect(handler).not.toHaveBeenCalled();
5967

0 commit comments

Comments
 (0)