Skip to content

Commit 0a3e0d0

Browse files
committed
test: remove no-op mock registrars
1 parent 2c3b582 commit 0a3e0d0

12 files changed

Lines changed: 8 additions & 34 deletions

extensions/slack/src/actions.blocks.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// Slack tests cover actions.blocks plugin behavior.
22
import { describe, expect, it } from "vitest";
3-
import { createSlackEditTestClient, installSlackBlockTestMocks } from "./blocks.test-helpers.js";
3+
import { createSlackEditTestClient } from "./blocks.test-helpers.js";
44

5-
installSlackBlockTestMocks();
65
const { editSlackMessage } = await import("./actions.js");
76
const SLACK_TEXT_LIMIT = 8000;
87

extensions/slack/src/blocks.test-helpers.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ vi.mock("./accounts.js", async () => {
3535
};
3636
});
3737

38-
// Kept for compatibility with existing tests; mocks install at module evaluation.
39-
export function installSlackBlockTestMocks() {}
40-
4138
export function createSlackEditTestClient(): SlackEditTestClient {
4239
return {
4340
chat: {

extensions/slack/src/send.blocks.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
// Slack tests cover send.blocks plugin behavior.
22
import { describe, expect, it } from "vitest";
3-
import { createSlackSendTestClient, installSlackBlockTestMocks } from "./blocks.test-helpers.js";
3+
import { createSlackSendTestClient } from "./blocks.test-helpers.js";
44
import {
55
clearSlackThreadParticipationCache,
66
hasSlackThreadParticipation,
77
} from "./sent-thread-cache.js";
88

9-
installSlackBlockTestMocks();
109
const { sendMessageSlack } = await import("./send.js");
1110
const SLACK_TEST_CFG = { channels: { slack: { botToken: "xoxb-test" } } };
1211
const SLACK_TEXT_LIMIT = 8000;

extensions/slack/src/send.identity-fallback.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
// Slack tests cover send.identity fallback plugin behavior.
22
import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
33
import { beforeEach, describe, expect, it, vi } from "vitest";
4-
import { createSlackSendTestClient, installSlackBlockTestMocks } from "./blocks.test-helpers.js";
4+
import { createSlackSendTestClient } from "./blocks.test-helpers.js";
55

66
vi.mock("openclaw/plugin-sdk/runtime-env", () => ({
77
logVerbose: vi.fn(),
88
danger: (message: string) => message,
99
shouldLogVerbose: () => false,
1010
}));
1111

12-
installSlackBlockTestMocks();
1312
const { sendMessageSlack } = await import("./send.js");
1413
const SLACK_TEST_CFG = { channels: { slack: { botToken: "xoxb-test" } } };
1514

extensions/slack/src/send.upload.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
// Slack tests cover send.upload plugin behavior.
22
import type { WebClient } from "@slack/web-api";
33
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
4-
import { installSlackBlockTestMocks } from "./blocks.test-helpers.js";
4+
import "./blocks.test-helpers.js";
55
import {
66
clearSlackThreadParticipationCache,
77
hasSlackThreadParticipation,
88
} from "./sent-thread-cache.js";
99

1010
// --- Module mocks (must precede dynamic import) ---
11-
installSlackBlockTestMocks();
1211
const loadOutboundMediaFromUrlMock = vi.hoisted(() =>
1312
vi.fn(async (_mediaUrl: string, _options?: unknown) => ({
1413
buffer: Buffer.from("fake-image"),

src/auto-reply/reply/get-reply.message-hooks.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
registerGetReplyRuntimeOverrides,
1111
} from "./get-reply.test-fixtures.js";
1212
import { loadGetReplyModuleForTest } from "./get-reply.test-loader.js";
13-
import { registerGetReplyCommonMocks } from "./get-reply.test-mocks.js";
13+
import "./get-reply.test-mocks.js";
1414

1515
const mocks = vi.hoisted(() => ({
1616
applyMediaUnderstanding: vi.fn(async (..._args: unknown[]) => undefined),
@@ -22,8 +22,6 @@ const mocks = vi.hoisted(() => ({
2222
initSessionState: vi.fn(),
2323
}));
2424

25-
registerGetReplyCommonMocks();
26-
2725
vi.mock("../../globals.js", () => ({
2826
logVerbose: vi.fn(),
2927
}));

src/auto-reply/reply/get-reply.test-mocks.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,3 @@ vi.mock("./stage-sandbox-media.runtime.js", () => ({
7777
vi.mock("./typing.js", () => ({
7878
createTypingController: vi.fn(() => createMockTypingController()),
7979
}));
80-
81-
/** Shared placeholder mock registrar for get-reply tests that need common mock imports. */
82-
export function registerGetReplyCommonMocks(): void {}

src/auto-reply/reply/get-reply.test-runtime-mocks.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Installs shared runtime mocks used by get-reply test modules.
22
import { vi } from "vitest";
3-
import { registerGetReplyCommonMocks } from "./get-reply.test-mocks.js";
4-
5-
registerGetReplyCommonMocks();
3+
import "./get-reply.test-mocks.js";
64

75
vi.mock("../../link-understanding/apply.runtime.js", () => ({
86
applyLinkUnderstanding: vi.fn(async () => undefined),

src/cli/program.nodes-basic.e2e.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
import { Command } from "commander";
33
import { beforeEach, describe, expect, it, vi } from "vitest";
44
import { createIosNodeListResponse } from "./program.nodes-test-helpers.js";
5-
import { callGateway, installBaseProgramMocks, runtime } from "./program.test-mocks.js";
6-
7-
installBaseProgramMocks();
5+
import { callGateway, runtime } from "./program.test-mocks.js";
86

97
let registerNodesCli: typeof import("./nodes-cli.js").registerNodesCli;
108

src/cli/program.nodes-media.e2e.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ import * as fs from "node:fs/promises";
33
import { Command } from "commander";
44
import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
55
import { IOS_NODE, createIosNodeListResponse } from "./program.nodes-test-helpers.js";
6-
import { callGateway, installBaseProgramMocks, runtime } from "./program.test-mocks.js";
6+
import { callGateway, runtime } from "./program.test-mocks.js";
77

8-
installBaseProgramMocks();
98
let registerNodesCli: typeof import("./nodes-cli.js").registerNodesCli;
109

1110
function getFirstRuntimeLogLine(): string {

0 commit comments

Comments
 (0)