Download packages/core/src/availability/testUtils.ts from SaylorTwift/gemini-cli: direct link, hf CLI and curl.
- Browser
- Download file 878 Bytes
-
https://huggingface.co/SaylorTwift/gemini-cli/resolve/main/packages/core/src/availability/testUtils.ts
- Command line
-
hf download hf://SaylorTwift/gemini-cli/packages/core/src/availability/testUtils.ts
-
curl -L -o testUtils.ts https://huggingface.co/SaylorTwift/gemini-cli/resolve/main/packages/core/src/availability/testUtils.ts
878 Bytes
| /** | |
| * @license | |
| * Copyright 2025 Google LLC | |
| * SPDX-License-Identifier: Apache-2.0 | |
| */ | |
| import { vi } from 'vitest'; | |
| import type { | |
| ModelAvailabilityService, | |
| ModelSelectionResult, | |
| } from './modelAvailabilityService.js'; | |
| /** | |
| * Test helper to create a fully mocked ModelAvailabilityService. | |
| */ | |
| export function createAvailabilityServiceMock( | |
| selection: ModelSelectionResult = { selectedModel: null, skipped: [] }, | |
| ): ModelAvailabilityService { | |
| const service = { | |
| markTerminal: vi.fn(), | |
| markHealthy: vi.fn(), | |
| markRetryOncePerTurn: vi.fn(), | |
| consumeStickyAttempt: vi.fn(), | |
| snapshot: vi.fn().mockReturnValue({ available: true }), | |
| resetTurn: vi.fn(), | |
| selectFirstAvailable: vi.fn().mockReturnValue(selection), | |
| }; | |
| // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion | |
| return service as unknown as ModelAvailabilityService; | |
| } | |