Skip to content

Commit aca3447

Browse files
committed
fix: clear mocks in writeModels test to prevent call count leakage
1 parent 387fe45 commit aca3447

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/api/providers/fetchers/__tests__/modelCache.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,10 @@ describe("isAuthScopedProvider", () => {
472472
})
473473

474474
describe("writeModels", () => {
475+
beforeEach(() => {
476+
vi.clearAllMocks()
477+
})
478+
475479
it("should write models to cache directory", async () => {
476480
const mockModels = {
477481
"test-model": {
@@ -492,7 +496,7 @@ describe("writeModels", () => {
492496
// Verify the path contains the cache directory and provider name
493497
expect(filePath).toContain("openrouter")
494498
expect(filePath).toContain(".json")
495-
// Verify the data is serialized correctly
496-
expect(data).toEqual({ models: mockModels, provider: "openrouter", timestamp: expect.any(Number) })
499+
// Verify the data is written as-is (writeModels does not wrap the payload)
500+
expect(data).toEqual(mockModels)
497501
})
498502
})

0 commit comments

Comments
 (0)