test: tighten discord listener error assertions

This commit is contained in:
Shakker
2026-05-10 21:32:15 +01:00
parent b115f90098
commit 2567ebc4ad

View File

@@ -135,8 +135,10 @@ describe("DiscordMessageListener", () => {
await expect(listener.handle(fakeEvent("ch-1"), {} as never)).resolves.toBeUndefined();
await flushAsyncWork();
expect(logger.error).toHaveBeenCalledWith(
expect.stringContaining("discord handler failed: Error: boom"),
expect(logger.error).toHaveBeenCalledTimes(1);
expect(logger.error.mock.calls[0]).toHaveLength(1);
expect(String(logger.error.mock.calls[0]?.[0])).toContain(
"discord handler failed: Error: boom",
);
});
@@ -182,8 +184,10 @@ describe("DiscordInteractionListener", () => {
await listener.handle({ id: "interaction-1" } as never, { handleInteraction } as never);
await flushAsyncWork();
expect(logger.error).toHaveBeenCalledWith(
expect.stringContaining("discord interaction handler failed: Error: interaction boom"),
expect(logger.error).toHaveBeenCalledTimes(1);
expect(logger.error.mock.calls[0]).toHaveLength(1);
expect(String(logger.error.mock.calls[0]?.[0])).toContain(
"discord interaction handler failed: Error: interaction boom",
);
});