diff --git a/extensions/mattermost/src/channel-actions-setup-status.contract.test.ts b/extensions/mattermost/src/channel-actions-setup-status.contract.test.ts index 3ed1863efa9..d399c603943 100644 --- a/extensions/mattermost/src/channel-actions-setup-status.contract.test.ts +++ b/extensions/mattermost/src/channel-actions-setup-status.contract.test.ts @@ -71,7 +71,6 @@ describe("mattermost setup contract", () => { expectedAccountId: "default", assertPatchedConfig: (cfg) => { const mattermostConfig = cfg.channels?.mattermost; - expect(mattermostConfig).toBeDefined(); if (!mattermostConfig) { throw new Error("expected Mattermost config patch"); } diff --git a/extensions/mattermost/src/doctor.test.ts b/extensions/mattermost/src/doctor.test.ts index 96ecd7b0357..cc16ff3b2f7 100644 --- a/extensions/mattermost/src/doctor.test.ts +++ b/extensions/mattermost/src/doctor.test.ts @@ -31,15 +31,18 @@ describe("mattermost doctor", () => { }); const mattermostConfig = result.config.channels?.mattermost; - expect(mattermostConfig).toBeDefined(); if (!mattermostConfig) { throw new Error("expected normalized Mattermost config"); } expect(mattermostConfig.network).toEqual({ dangerouslyAllowPrivateNetwork: true, }); - const workAccount = mattermostConfig.accounts?.work as { network?: Record }; - expect(workAccount).toBeDefined(); + const workAccount = mattermostConfig.accounts?.work as + | { network?: Record } + | undefined; + if (!workAccount) { + throw new Error("expected Mattermost work account config"); + } expect(workAccount.network).toEqual({ dangerouslyAllowPrivateNetwork: false, }); diff --git a/extensions/mattermost/src/mattermost/client.test.ts b/extensions/mattermost/src/mattermost/client.test.ts index c280fcfd903..6cbf3a91f7f 100644 --- a/extensions/mattermost/src/mattermost/client.test.ts +++ b/extensions/mattermost/src/mattermost/client.test.ts @@ -277,12 +277,10 @@ describe("updateMattermostPost", () => { const { calls } = await updatePostAndCapture({ message: "Updated" }); const firstCall = calls[0]; - expect(firstCall).toBeDefined(); if (!firstCall) { throw new Error("expected Mattermost update post request"); } expect(firstCall.url).toContain("/posts/post1"); - expect(firstCall.init).toBeDefined(); if (!firstCall.init) { throw new Error("expected Mattermost update post request init"); } diff --git a/extensions/mattermost/src/mattermost/model-picker.test.ts b/extensions/mattermost/src/mattermost/model-picker.test.ts index 2e53b9e336f..c3c37e94dcc 100644 --- a/extensions/mattermost/src/mattermost/model-picker.test.ts +++ b/extensions/mattermost/src/mattermost/model-picker.test.ts @@ -60,12 +60,10 @@ describe("Mattermost model picker", () => { expect(view.text).toContain("Browse keeps the current runtime"); expect(view.text).toContain("/oc_model --runtime "); const firstRow = view.buttons[0]; - expect(firstRow).toBeDefined(); if (!firstRow) { throw new Error("expected Mattermost model picker button row"); } const browseButton = firstRow[0]; - expect(browseButton).toBeDefined(); if (!browseButton) { throw new Error("expected Mattermost browse providers button"); } diff --git a/extensions/mattermost/src/mattermost/slash-commands.test.ts b/extensions/mattermost/src/mattermost/slash-commands.test.ts index 2e3fb09f192..d2f756f08d9 100644 --- a/extensions/mattermost/src/mattermost/slash-commands.test.ts +++ b/extensions/mattermost/src/mattermost/slash-commands.test.ts @@ -131,7 +131,6 @@ describe("slash-commands", () => { expect(result).toHaveLength(1); const firstCommand = result[0]; - expect(firstCommand).toBeDefined(); if (!firstCommand) { throw new Error("expected Mattermost slash command result"); } diff --git a/extensions/mattermost/src/setup.test.ts b/extensions/mattermost/src/setup.test.ts index 361abb6b12d..9af8238d314 100644 --- a/extensions/mattermost/src/setup.test.ts +++ b/extensions/mattermost/src/setup.test.ts @@ -392,7 +392,6 @@ describe("mattermost setup", () => { ); expect(textMessages).toEqual(["Enter Mattermost bot token", "Enter Mattermost base URL"]); const mattermostConfig = result.cfg.channels?.mattermost; - expect(mattermostConfig).toBeDefined(); if (!mattermostConfig) { throw new Error("expected Mattermost config"); } diff --git a/extensions/synology-chat/src/client.test.ts b/extensions/synology-chat/src/client.test.ts index 37bf9cd26a4..d305342faeb 100644 --- a/extensions/synology-chat/src/client.test.ts +++ b/extensions/synology-chat/src/client.test.ts @@ -122,7 +122,6 @@ describe("Synology Chat TLS verification defaults", () => { await settleTimers(invoke()); const httpsRequest = vi.mocked(https.request); const firstCall = httpsRequest.mock.calls[0]; - expect(firstCall).toBeDefined(); if (!firstCall) { throw new Error("expected Synology Chat HTTPS request"); } @@ -159,7 +158,6 @@ describe("sendMessage", () => { await settleTimers(sendMessage("https://nas.example.com/incoming", "Hello", undefined, true)); const httpsRequest = vi.mocked(https.request); const firstCall = httpsRequest.mock.calls[0]; - expect(firstCall).toBeDefined(); if (!firstCall) { throw new Error("expected Synology Chat HTTPS request"); } @@ -387,7 +385,6 @@ describe("fetchChatUsers", () => { const httpsGet = vi.mocked(https.get); const firstCall = httpsGet.mock.calls[0]; - expect(firstCall).toBeDefined(); if (!firstCall) { throw new Error("expected Synology Chat HTTPS get"); } diff --git a/test/scripts/vitest-process-group.test.ts b/test/scripts/vitest-process-group.test.ts index f8d1c321050..c0c2a7d47fc 100644 --- a/test/scripts/vitest-process-group.test.ts +++ b/test/scripts/vitest-process-group.test.ts @@ -9,7 +9,6 @@ import { describe("vitest process group helpers", () => { function getListenerSet(listeners: Map void>>, event: string) { const set = listeners.get(event); - expect(set).toBeDefined(); if (!set) { throw new Error(`expected ${event} listener set`); }