Skip to content

Commit 57af5f1

Browse files
committed
chore: simplify i18n mocking in Task.spec.ts
1 parent c541dd7 commit 57af5f1

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
@@ -160,21 +160,16 @@ vi.mock("../../environment/getEnvironmentDetails", () => ({
160160

161161
vi.mock("../../ignore/RooIgnoreController")
162162

163-
// i18n is not initialized in this suite, so the real t() returns the raw translation key.
164-
// Interpolate just the missing-parameter keys so tests can assert on the resolved, user-facing
165-
// copy; every other key is delegated to the real t() to keep the rest of the suite unchanged.
166-
vi.mock("../../../i18n", async (importOriginal) => {
167-
const actual = (await importOriginal()) as typeof import("../../../i18n")
163+
vi.mock("../../../i18n", () => {
168164
return {
169-
...actual,
170165
t: (key: string, args?: Record<string, unknown>) => {
171166
if (key === "tools:missingToolParameterWithPath") {
172-
return `Zoo tried to use ${args?.toolName} for '${args?.relPath}' without value for required parameter '${args?.paramName}'. Retrying...`
167+
return `${args?.toolName}|${args?.relPath}|${args?.paramName}`
173168
}
174169
if (key === "tools:missingToolParameter") {
175-
return `Zoo tried to use ${args?.toolName} without value for required parameter '${args?.paramName}'. Retrying...`
170+
return `${args?.toolName}|${args?.paramName}`
176171
}
177-
return actual.t(key, args)
172+
return key
178173
},
179174
}
180175
})

0 commit comments

Comments
 (0)