| 2722 | |
| 2723 | describe("Queued message processing after condense", () => { |
| 2724 | function createProvider(): any { |
| 2725 | const storageUri = { fsPath: path.join(os.tmpdir(), "test-storage") } |
| 2726 | const ctx = { |
| 2727 | globalState: { |
| 2728 | get: vi.fn().mockImplementation((_key: keyof GlobalState) => undefined), |
| 2729 | update: vi.fn().mockResolvedValue(undefined), |
| 2730 | keys: vi.fn().mockReturnValue([]), |
| 2731 | }, |
| 2732 | globalStorageUri: storageUri, |
| 2733 | workspaceState: { |
| 2734 | get: vi.fn().mockImplementation((_key) => undefined), |
| 2735 | update: vi.fn().mockResolvedValue(undefined), |
| 2736 | keys: vi.fn().mockReturnValue([]), |
| 2737 | }, |
| 2738 | secrets: { |
| 2739 | get: vi.fn().mockResolvedValue(undefined), |
| 2740 | store: vi.fn().mockResolvedValue(undefined), |
| 2741 | delete: vi.fn().mockResolvedValue(undefined), |
| 2742 | }, |
| 2743 | extensionUri: { fsPath: "/mock/extension/path" }, |
| 2744 | extension: { packageJSON: { version: "1.0.0" } }, |
| 2745 | } as unknown as vscode.ExtensionContext |
| 2746 | |
| 2747 | const output = { |
| 2748 | appendLine: vi.fn(), |
| 2749 | append: vi.fn(), |
| 2750 | clear: vi.fn(), |
| 2751 | show: vi.fn(), |
| 2752 | hide: vi.fn(), |
| 2753 | dispose: vi.fn(), |
| 2754 | } |
| 2755 | |
| 2756 | const provider = new ClineProvider(ctx, output as any, "sidebar", new ContextProxy(ctx)) as any |
| 2757 | provider.postMessageToWebview = vi.fn().mockResolvedValue(undefined) |
| 2758 | provider.postStateToWebview = vi.fn().mockResolvedValue(undefined) |
| 2759 | provider.postStateToWebviewWithoutTaskHistory = vi.fn().mockResolvedValue(undefined) |
| 2760 | provider.getState = vi.fn().mockResolvedValue({}) |
| 2761 | return provider |
| 2762 | } |
| 2763 | |
| 2764 | const apiConfig: ProviderSettings = { |
| 2765 | apiProvider: "anthropic", |