From 277ede4b1c402cd4a6507032e17f484d2f8328bd Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 12 May 2026 00:42:28 +0100 Subject: [PATCH] test: guard mattermost channel mock calls --- extensions/mattermost/src/channel.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extensions/mattermost/src/channel.test.ts b/extensions/mattermost/src/channel.test.ts index 54d95d20e4e..07a6b64e0a3 100644 --- a/extensions/mattermost/src/channel.test.ts +++ b/extensions/mattermost/src/channel.test.ts @@ -105,7 +105,11 @@ function createMattermostActionContext( function expectSingleMattermostSend(to: string, text: string): Record { expect(sendMessageMattermostMock).toHaveBeenCalledTimes(1); - const [actualTo, actualText, options] = sendMessageMattermostMock.mock.calls[0] ?? []; + const [call] = sendMessageMattermostMock.mock.calls; + if (!call) { + throw new Error("expected Mattermost send call"); + } + const [actualTo, actualText, options] = call; expect(actualTo).toBe(to); expect(actualText).toBe(text); if (!options || typeof options !== "object" || Array.isArray(options)) {