mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-17 02:37:33 +00:00
test: guard slack probe mock calls
This commit is contained in:
@@ -13,6 +13,14 @@ vi.mock("openclaw/plugin-sdk/text-utility-runtime", () => ({
|
||||
withTimeout: withTimeoutMock,
|
||||
}));
|
||||
|
||||
function requireFirstTimeoutCall() {
|
||||
const [call] = withTimeoutMock.mock.calls;
|
||||
if (!call) {
|
||||
throw new Error("expected withTimeout call");
|
||||
}
|
||||
return call;
|
||||
}
|
||||
|
||||
describe("probeSlack", () => {
|
||||
beforeEach(() => {
|
||||
authTestMock.mockReset();
|
||||
@@ -46,8 +54,9 @@ describe("probeSlack", () => {
|
||||
});
|
||||
expect(createSlackWebClientMock).toHaveBeenCalledWith("xoxb-test");
|
||||
expect(withTimeoutMock).toHaveBeenCalledTimes(1);
|
||||
expect(withTimeoutMock.mock.calls[0]?.[0]).toBeInstanceOf(Promise);
|
||||
expect(withTimeoutMock.mock.calls[0]?.[1]).toBe(2500);
|
||||
const [promise, timeoutMs] = requireFirstTimeoutCall();
|
||||
expect(promise).toBeInstanceOf(Promise);
|
||||
expect(timeoutMs).toBe(2500);
|
||||
});
|
||||
|
||||
it("keeps optional auth metadata fields undefined when Slack omits them", async () => {
|
||||
|
||||
Reference in New Issue
Block a user