test: dedupe and optimize test suites

This commit is contained in:
Peter Steinberger
2026-02-19 15:18:50 +00:00
parent b0e55283d5
commit a1cb700a05
80 changed files with 2627 additions and 2962 deletions

View File

@@ -1,4 +1,4 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
const {
GatewayIntents,
@@ -70,6 +70,12 @@ vi.mock("ws", () => ({
}));
describe("createDiscordGatewayPlugin", () => {
let createDiscordGatewayPlugin: typeof import("./gateway-plugin.js").createDiscordGatewayPlugin;
beforeAll(async () => {
({ createDiscordGatewayPlugin } = await import("./gateway-plugin.js"));
});
function createRuntime() {
return {
log: vi.fn(),
@@ -87,7 +93,6 @@ describe("createDiscordGatewayPlugin", () => {
});
it("uses proxy agent for gateway WebSocket when configured", async () => {
const { createDiscordGatewayPlugin } = await import("./gateway-plugin.js");
const runtime = createRuntime();
const plugin = createDiscordGatewayPlugin({
@@ -111,7 +116,6 @@ describe("createDiscordGatewayPlugin", () => {
});
it("falls back to the default gateway plugin when proxy is invalid", async () => {
const { createDiscordGatewayPlugin } = await import("./gateway-plugin.js");
const runtime = createRuntime();
const plugin = createDiscordGatewayPlugin({