Skip to content

Commit d68d86f

Browse files
committed
chore: simplify i18n mocking in Task.spec.ts
1 parent e40dc87 commit d68d86f

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

src/core/task/__tests__/Task.spec.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -187,21 +187,16 @@ vi.mock("../../environment/getEnvironmentDetails", () => ({
187187

188188
vi.mock("../../ignore/RooIgnoreController")
189189

190-
// i18n is not initialized in this suite, so the real t() returns the raw translation key.
191-
// Interpolate just the missing-parameter keys so tests can assert on the resolved, user-facing
192-
// copy; every other key is delegated to the real t() to keep the rest of the suite unchanged.
193-
vi.mock("../../../i18n", async (importOriginal) => {
194-
const actual = (await importOriginal()) as typeof import("../../../i18n")
190+
vi.mock("../../../i18n", () => {
195191
return {
196-
...actual,
197192
t: (key: string, args?: Record<string, unknown>) => {
198193
if (key === "tools:missingToolParameterWithPath") {
199-
return `Zoo tried to use ${args?.toolName} for '${args?.relPath}' without value for required parameter '${args?.paramName}'. Retrying...`
194+
return `${args?.toolName}|${args?.relPath}|${args?.paramName}`
200195
}
201196
if (key === "tools:missingToolParameter") {
202-
return `Zoo tried to use ${args?.toolName} without value for required parameter '${args?.paramName}'. Retrying...`
197+
return `${args?.toolName}|${args?.paramName}`
203198
}
204-
return actual.t(key, args)
199+
return key
205200
},
206201
}
207202
})

0 commit comments

Comments
 (0)