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)) {