continue-custom/core/config/profile/LocalProfileLoader.vitest.ts
Nate bf5906fd89 fix: resolve TypeScript compilation errors from merge
- Fix LocalProfileLoader test: remove controlPlaneClient refs, update
  default title to match "Main Config"
- Remove showStagingIndicator from Layout.tsx (variable was undefined)
- Remove usePlatform from MockIdeMessenger (removed from config types)
- Add GithubIcon component and DISCUSSIONS_LINK to StreamError.tsx
- Add overloaded retry constants to streamThunkWrapper.tsx

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 14:26:04 -07:00

87 lines
2.4 KiB
TypeScript

import { describe, expect, it, vi } from "vitest";
import { LLMLogger } from "../../llm/logger.js";
import { testIde } from "../../test/fixtures.js";
import LocalProfileLoader from "./LocalProfileLoader.js";
// Mock doLoadConfig to capture the arguments it receives
const mockDoLoadConfig = vi.fn().mockResolvedValue({
config: undefined,
errors: [],
configLoadInterrupted: false,
});
vi.mock("./doLoadConfig.js", () => ({
default: (...args: any[]) => mockDoLoadConfig(...args),
}));
describe("LocalProfileLoader", () => {
const llmLogger = new LLMLogger();
it("should pass pre-read content in packageIdentifier for override files", async () => {
const overrideFile = {
path: "vscode-remote://wsl+Ubuntu/home/user/.continue/agents/test.yaml",
content: "name: Test\nversion: 1.0.0\nschema: v1\n",
};
const loader = new LocalProfileLoader(testIde, llmLogger, overrideFile);
await loader.doLoadConfig();
expect(mockDoLoadConfig).toHaveBeenCalledWith(
expect.objectContaining({
packageIdentifier: expect.objectContaining({
uriType: "file",
fileUri: overrideFile.path,
content: overrideFile.content,
}),
}),
);
});
it("should not include content in packageIdentifier when no override file", async () => {
const loader = new LocalProfileLoader(testIde, llmLogger);
await loader.doLoadConfig();
expect(mockDoLoadConfig).toHaveBeenCalledWith(
expect.objectContaining({
packageIdentifier: expect.objectContaining({
uriType: "file",
content: undefined,
}),
}),
);
});
it("should update title from configName when available", async () => {
mockDoLoadConfig.mockResolvedValueOnce({
config: {},
errors: [],
configLoadInterrupted: false,
configName: "My Custom Config",
});
const loader = new LocalProfileLoader(testIde, llmLogger);
expect(loader.description.title).toBe("Main Config");
await loader.doLoadConfig();
expect(loader.description.title).toBe("My Custom Config");
});
it("should keep default title when configName is not set", async () => {
mockDoLoadConfig.mockResolvedValueOnce({
config: {},
errors: [],
configLoadInterrupted: false,
});
const loader = new LocalProfileLoader(testIde, llmLogger);
await loader.doLoadConfig();
expect(loader.description.title).toBe("Main Config");
});
});