mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 02:54:31 +00:00
test: dedupe and optimize test suites
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user