Skip to content

Commit e8b59c6

Browse files
author
IL
committed
fix(tests): update rename and prompt tests for current API signatures
- rename.test.ts: setCurrentSession now takes channel as first arg - prompt.test.ts: mock injectMemoryIntoPrompt to avoid channel prefix injection; use t() for error messages to be locale-agnostic
1 parent f2d9911 commit e8b59c6

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

tests/bot/handlers/prompt.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { beforeEach, describe, expect, it, vi } from "vitest";
22
import type { Bot, Context } from "grammy";
33
import { processUserPrompt, type ProcessPromptDeps } from "../../../src/bot/handlers/prompt.js";
4+
import { t } from "../../../src/i18n/index.js";
45

56
const mocked = vi.hoisted(() => ({
67
currentProject: { id: "project-1", worktree: "D:\\Projects\\Repo" },
@@ -108,6 +109,10 @@ vi.mock("../../../src/utils/error-format.js", () => ({
108109
formatErrorDetails: vi.fn(() => "formatted error"),
109110
}));
110111

112+
vi.mock("../../../src/memory/injector.js", () => ({
113+
injectMemoryIntoPrompt: vi.fn(async (text: string) => text),
114+
}));
115+
111116
vi.mock("../../../src/scheduled-task/foreground-state.js", () => ({
112117
foregroundSessionState: {
113118
markBusy: vi.fn(),
@@ -255,7 +260,7 @@ describe("bot/handlers/prompt", () => {
255260

256261
expect(deps.bot.api.sendMessage).toHaveBeenCalledWith(
257262
777,
258-
"Failed to send request to OpenCode.",
263+
t("bot.prompt_send_error"),
259264
);
260265
});
261266

@@ -277,7 +282,7 @@ describe("bot/handlers/prompt", () => {
277282

278283
expect(deps.bot.api.sendMessage).toHaveBeenCalledWith(
279284
777,
280-
"Failed to send request to OpenCode.",
285+
t("bot.prompt_send_error"),
281286
);
282287
});
283288

0 commit comments

Comments
 (0)