diff --git a/extensions/discord/src/internal/gateway.test.ts b/extensions/discord/src/internal/gateway.test.ts index ba37791f6d8..206bafccfbb 100644 --- a/extensions/discord/src/internal/gateway.test.ts +++ b/extensions/discord/src/internal/gateway.test.ts @@ -484,15 +484,15 @@ describe("GatewayPlugin", () => { expect(gateway.ws).toBeNull(); expect(gateway.firstHeartbeatTimeout).toBeUndefined(); expect(gateway.heartbeatInterval).toBeUndefined(); - expect(() => vi.advanceTimersByTime(20)).not.toThrow(); + vi.advanceTimersByTime(20); expect(send).not.toHaveBeenCalled(); - expect(() => + expect( ( gateway as unknown as { sendHeartbeat(): void; } ).sendHeartbeat(), - ).not.toThrow(); + ).toBeUndefined(); }); it("clears stale heartbeat timers before early reconnect exits", () => { diff --git a/extensions/discord/src/monitor/provider.test.ts b/extensions/discord/src/monitor/provider.test.ts index de5b6479562..c6390da5ccc 100644 --- a/extensions/discord/src/monitor/provider.test.ts +++ b/extensions/discord/src/monitor/provider.test.ts @@ -327,9 +327,9 @@ describe("monitorDiscordProvider", () => { expect(monitorLifecycleMock).not.toHaveBeenCalled(); expect(disconnect).toHaveBeenCalledTimes(1); - expect(() => + expect( emitter.emit("error", new Error("Max reconnect attempts (0) reached after code 1005")), - ).not.toThrow(); + ).toBe(true); expect(runtime.error).toHaveBeenCalledWith( expect.stringContaining("suppressed late gateway reconnect-exhausted error after dispose"), ); diff --git a/extensions/discord/src/voice/manager.e2e.test.ts b/extensions/discord/src/voice/manager.e2e.test.ts index 59d178e238b..9e074017c70 100644 --- a/extensions/discord/src/voice/manager.e2e.test.ts +++ b/extensions/discord/src/voice/manager.e2e.test.ts @@ -412,7 +412,7 @@ describe("DiscordVoiceManager", () => { expectConnectedStatus(manager, "1002"); }); - it("does not throw when stale tracked voice connections are already destroyed", async () => { + it("skips destroying stale tracked voice connections that are already destroyed", async () => { const staleConnection = createConnectionMock(); staleConnection.state.status = "destroyed"; staleConnection.destroy.mockImplementation(() => { @@ -429,7 +429,7 @@ describe("DiscordVoiceManager", () => { expect(staleConnection.destroy).not.toHaveBeenCalled(); }); - it("does not throw when leaving an already destroyed voice connection", async () => { + it("skips destroying an already destroyed voice connection on leave", async () => { const connection = createConnectionMock(); connection.destroy.mockImplementation(() => { throw new Error("Cannot destroy VoiceConnection - it has already been destroyed"); @@ -1095,7 +1095,7 @@ describe("DiscordVoiceManager", () => { expect(agentCommandMock).toHaveBeenCalledTimes(1); }); - it("DiscordVoiceReadyListener: propagates autoJoin errors fire-and-forget without throwing", async () => { + it("DiscordVoiceReadyListener: starts autoJoin fire-and-forget on ready", async () => { const manager = createManager(); const autoJoinSpy = vi .spyOn(manager, "autoJoin") @@ -1104,7 +1104,7 @@ describe("DiscordVoiceManager", () => { const { DiscordVoiceReadyListener } = managerModule; const listener = new DiscordVoiceReadyListener(manager); - await expect(listener.handle(undefined, undefined as never)).resolves.not.toThrow(); + await expect(listener.handle(undefined, undefined as never)).resolves.toBeUndefined(); expect(autoJoinSpy).toHaveBeenCalledTimes(1); }); @@ -1115,7 +1115,7 @@ describe("DiscordVoiceManager", () => { const { DiscordVoiceResumedListener } = managerModule; const listener = new DiscordVoiceResumedListener(manager); - await expect(listener.handle(undefined, undefined as never)).resolves.not.toThrow(); + await expect(listener.handle(undefined, undefined as never)).resolves.toBeUndefined(); expect(autoJoinSpy).toHaveBeenCalledTimes(1); }); }); diff --git a/extensions/matrix/src/matrix/monitor/mentions.test.ts b/extensions/matrix/src/matrix/monitor/mentions.test.ts index 14aae68654e..3c18a690858 100644 --- a/extensions/matrix/src/matrix/monitor/mentions.test.ts +++ b/extensions/matrix/src/matrix/monitor/mentions.test.ts @@ -228,7 +228,7 @@ describe("resolveMentions", () => { }); it("ignores out-of-range hexadecimal HTML entities in visible labels", () => { - expect(() => + expect( resolveMentions({ content: { msgtype: "m.text", @@ -239,11 +239,11 @@ describe("resolveMentions", () => { text: "hello", mentionRegexes: [], }), - ).not.toThrow(); + ).toEqual({ hasExplicitMention: false, wasMentioned: false }); }); it("ignores oversized decimal HTML entities in visible labels", () => { - expect(() => + expect( resolveMentions({ content: { msgtype: "m.text", @@ -255,7 +255,7 @@ describe("resolveMentions", () => { text: "hello", mentionRegexes: [], }), - ).not.toThrow(); + ).toEqual({ hasExplicitMention: false, wasMentioned: false }); }); it("does not detect mention when displayName is spoofed", () => { diff --git a/extensions/matrix/src/matrix/sdk.test.ts b/extensions/matrix/src/matrix/sdk.test.ts index 693e638e2ad..8026f7ffc82 100644 --- a/extensions/matrix/src/matrix/sdk.test.ts +++ b/extensions/matrix/src/matrix/sdk.test.ts @@ -1573,8 +1573,7 @@ describe("MatrixClient crypto bootstrapping", () => { } ).cryptoBootstrapper.bootstrap = bootstrapSpy; - // start() must NOT throw even when the repair bootstrap fails - await expect(client.start()).resolves.not.toThrow(); + await expect(client.start()).resolves.toBeUndefined(); // repair was attempted expect(bootstrapSpy).toHaveBeenCalledTimes(2);