diff --git a/src/commands/models.list.e2e.test.ts b/src/commands/models.list.e2e.test.ts index 182657e466f..7f32d332438 100644 --- a/src/commands/models.list.e2e.test.ts +++ b/src/commands/models.list.e2e.test.ts @@ -50,41 +50,34 @@ vi.mock("../agents/model-auth.js", () => ({ })); vi.mock("@mariozechner/pi-coding-agent", async () => { - const actual = await vi.importActual( - "@mariozechner/pi-coding-agent", - ); - class MockAuthStorage {} class MockModelRegistry { - find(provider: string, id: string): ReturnType { + find(provider: string, id: string) { const found = modelRegistryState.models.find((model) => model.provider === provider && model.id === id) ?? null; - return found as ReturnType; + return found; } - getAll(): ReturnType { + getAll() { if (modelRegistryState.getAllError !== undefined) { throw modelRegistryState.getAllError; } - return modelRegistryState.models as ReturnType; + return modelRegistryState.models; } - getAvailable(): ReturnType { + getAvailable() { if (modelRegistryState.getAvailableError !== undefined) { throw modelRegistryState.getAvailableError; } - return modelRegistryState.available as ReturnType< - typeof actual.ModelRegistry.prototype.getAvailable - >; + return modelRegistryState.available; } } return { - ...actual, - AuthStorage: MockAuthStorage as unknown as typeof actual.AuthStorage, - ModelRegistry: MockModelRegistry as unknown as typeof actual.ModelRegistry, + AuthStorage: MockAuthStorage, + ModelRegistry: MockModelRegistry, }; });