test(regression): cover recent landed fix paths
This commit is contained in:
@@ -518,6 +518,35 @@ describe("runWithModelFallback", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("sanitizes model identifiers in model_not_found warnings", async () => {
|
||||
setLoggerOverride({ level: "silent", consoleLevel: "warn" });
|
||||
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
|
||||
try {
|
||||
const cfg = makeCfg();
|
||||
const run = vi
|
||||
.fn()
|
||||
.mockRejectedValueOnce(new Error("Model not found: openai/gpt-6"))
|
||||
.mockResolvedValueOnce("ok");
|
||||
|
||||
const result = await runWithModelFallback({
|
||||
cfg,
|
||||
provider: "openai",
|
||||
model: "gpt-6\u001B[31m\nspoof",
|
||||
run,
|
||||
});
|
||||
|
||||
expect(result.result).toBe("ok");
|
||||
const warning = warnSpy.mock.calls[0]?.[0] as string;
|
||||
expect(warning).toContain('Model "openai/gpt-6spoof" not found');
|
||||
expect(warning).not.toContain("\u001B");
|
||||
expect(warning).not.toContain("\n");
|
||||
} finally {
|
||||
warnSpy.mockRestore();
|
||||
setLoggerOverride(null);
|
||||
resetLogger();
|
||||
}
|
||||
});
|
||||
|
||||
it("skips providers when all profiles are in cooldown", async () => {
|
||||
await expectSkippedUnavailableProvider({
|
||||
providerPrefix: "cooldown-test",
|
||||
|
||||
Reference in New Issue
Block a user