Elffuss BraidHub

kikocis/continue public

be26cc4523c9 · 1.8 KiBRawPermalink
1import fs from "node:fs";
2import path from "node:path";
3
4import { testConfigHandler } from "../test/fixtures";
5import { TEST_DIR } from "../test/testDir";
6import { getConfigTsPath } from "../util/paths";
7
8import { defaultConfig } from "./default";
9
10describe.skip("Test the ConfigHandler and E2E config loading", () => {
11 test("should show only local profile", () => {
12 const profiles = testConfigHandler.currentOrg.profiles;
13 expect(profiles?.length).toBe(1);
14 expect(profiles?.[0].profileDescription.id).toBe("local");
15
16 const currentProfile = testConfigHandler.currentProfile;
17 expect(currentProfile?.profileDescription.id).toBe("local");
18 });
19
20 test("should load the default config successfully", async () => {
21 const result = await testConfigHandler.loadConfig();
22 expect(result.config!.modelsByRole.chat.length).toBe(
23 defaultConfig.models?.length,
24 );
25 });
26
27 test.skip("should add a system message from config.ts", async () => {
28 const configTs = `export function modifyConfig(config: Config): Config {
29 config.systemMessage = "SYSTEM";
30 return config;
31}`;
32 fs.writeFileSync(getConfigTsPath(), configTs);
33 await new Promise((resolve) => setTimeout(resolve, 1000));
34 const config = await testConfigHandler.reloadConfig();
35 /**
36 * @ts-ignore is applied because this test is skipped
37 */
38 // @ts-ignore
39 expect(config.systemMessage).toBe("SYSTEM");
40 });
41
42 test.skip("should acknowledge override from .continuerc.json", async () => {
43 fs.writeFileSync(
44 path.join(TEST_DIR, ".continuerc.json"),
45 JSON.stringify({ systemMessage: "SYSTEM2" }),
46 );
47 const config = await testConfigHandler.reloadConfig();
48 /**
49 * @ts-ignore is applied because this test is skipped
50 */
51 // @ts-ignore
52 expect(config.systemMessage).toBe("SYSTEM2");
53 });
54});