Skip to content

Commit 35ba1de

Browse files
committed
test: guard discord action mock calls
1 parent f006e97 commit 35ba1de

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎extensions/discord/src/actions/handle-action.test.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ function expectDiscordActionCall(params: {
2727
options?: unknown;
2828
}) {
2929
expect(handleDiscordActionMock).toHaveBeenCalledTimes(1);
30-
const [payload, cfg, options] = handleDiscordActionMock.mock.calls[0] ?? [];
30+
const [call] = handleDiscordActionMock.mock.calls;
31+
if (!call) {
32+
throw new Error("expected Discord action call");
33+
}
34+
const [payload, cfg, options] = call;
3135
expect(payload).toEqual(params.payload);
3236
expect(cfg).toBe(params.cfg);
3337
if ("options" in params) {

0 commit comments

Comments
 (0)