test: tighten cli gateway assertions

This commit is contained in:
Peter Steinberger
2026-05-11 15:07:54 +01:00
parent fd7448299f
commit 281a88d6df
7 changed files with 66 additions and 74 deletions

View File

@@ -83,16 +83,12 @@ describe("registerMessageThreadCommands", () => {
{ from: "user" },
);
expect(runMessageAction).toHaveBeenCalledWith(
"topic-create",
expect.objectContaining({
channel: " topic-chat ",
target: "room-1",
name: "Build Updates",
message: "hello",
}),
);
const remappedCall = runMessageAction.mock.calls.at(0);
expect(remappedCall?.[0]).toBe("topic-create");
expect(remappedCall?.[1]?.channel).toBe(" topic-chat ");
expect(remappedCall?.[1]?.target).toBe("room-1");
expect(remappedCall?.[1]?.name).toBe("Build Updates");
expect(remappedCall?.[1]?.message).toBe("hello");
expect(remappedCall?.[1]).not.toHaveProperty("threadName");
});
@@ -116,16 +112,12 @@ describe("registerMessageThreadCommands", () => {
{ from: "user" },
);
expect(runMessageAction).toHaveBeenCalledWith(
"thread-create",
expect.objectContaining({
channel: "plain-chat",
target: "channel:123",
threadName: "Build Updates",
message: "hello",
}),
);
const defaultCall = runMessageAction.mock.calls.at(0);
expect(defaultCall?.[0]).toBe("thread-create");
expect(defaultCall?.[1]?.channel).toBe("plain-chat");
expect(defaultCall?.[1]?.target).toBe("channel:123");
expect(defaultCall?.[1]?.threadName).toBe("Build Updates");
expect(defaultCall?.[1]?.message).toBe("hello");
expect(defaultCall?.[1]).not.toHaveProperty("name");
});
});