mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-24 04:47:03 +00:00
Fixes incomplete cliModelSkus while agent acp holds the CLI lock (#831) and replace single-pid ACP lock with cross-process refcount (#832). Web picker merges machine/session catalogs and waits for SKU readiness before showing variant labels. Fixes #831 Fixes #832 Co-authored-by: Cursor <cursoragent@cursor.com>
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import { afterEach, describe, expect, test, vi } from 'vitest';
|
|
|
|
const listCursorModelsMock = vi.hoisted(() => vi.fn());
|
|
|
|
vi.mock('./cursorModels', () => ({
|
|
listCursorModels: listCursorModelsMock
|
|
}));
|
|
|
|
import { scheduleCursorModelsPrewarm } from './cursorModelsPrewarm';
|
|
|
|
afterEach(() => {
|
|
listCursorModelsMock.mockReset();
|
|
});
|
|
|
|
describe('scheduleCursorModelsPrewarm', () => {
|
|
test('starts a background listCursorModels call', async () => {
|
|
listCursorModelsMock.mockResolvedValue({
|
|
success: true,
|
|
availableModels: [],
|
|
currentModelId: null
|
|
});
|
|
|
|
scheduleCursorModelsPrewarm();
|
|
|
|
await Promise.resolve();
|
|
|
|
expect(listCursorModelsMock).toHaveBeenCalledTimes(1);
|
|
});
|
|
|
|
test('swallows listCursorModels failures', async () => {
|
|
listCursorModelsMock.mockRejectedValue(new Error('agent missing'));
|
|
|
|
scheduleCursorModelsPrewarm();
|
|
|
|
await Promise.resolve();
|
|
|
|
expect(listCursorModelsMock).toHaveBeenCalledTimes(1);
|
|
});
|
|
});
|