-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconflictResolver.launch.test.ts
More file actions
129 lines (118 loc) · 3.84 KB
/
Copy pathconflictResolver.launch.test.ts
File metadata and controls
129 lines (118 loc) · 3.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import { describe, expect, it } from "vitest";
import type { AgentStatus } from "@/shared/contracts";
import {
readConflictResolverSettingsForProject,
resolveConflictResolverLaunchConfig,
} from "./conflictResolver";
import { resolveConflictResolverConfig } from "./ProviderIcon";
import "./claude";
import "./codex";
import "./cursor";
import "./gemini";
const cursorStatus = {
kind: "cursor",
label: "Cursor",
installed: true,
authState: "authenticated",
capabilities: {
models: [
{ id: "auto", label: "Auto" },
{ id: "composer-2.5", label: "Composer 2.5" },
],
efforts: [] as string[],
modelEfforts: {} as Record<string, string[]>,
},
} as AgentStatus;
describe("readConflictResolverSettingsForProject", () => {
const settings = {
conflictResolverProvider: "cursor",
conflictResolverModel: "composer-2.5",
conflictResolverEffort: "",
conflictResolverPresentationMode: "terminal" as const,
wslConflictResolverProvider: "auto",
wslConflictResolverModel: "",
wslConflictResolverEffort: "",
wslConflictResolverPresentationMode: "gui" as const,
};
it("uses Windows settings for native projects", () => {
expect(readConflictResolverSettingsForProject("windows", settings)).toEqual({
provider: "cursor",
model: "composer-2.5",
effort: "",
presentationMode: "terminal",
});
});
it("falls back to Windows settings for WSL projects when WSL conflict resolver is unset", () => {
expect(readConflictResolverSettingsForProject("wsl", settings)).toEqual({
provider: "cursor",
model: "composer-2.5",
effort: "",
presentationMode: "terminal",
});
});
it("falls back to Windows settings for SSH projects when WSL conflict resolver is unset", () => {
expect(readConflictResolverSettingsForProject("ssh", settings)).toEqual({
provider: "cursor",
model: "composer-2.5",
effort: "",
presentationMode: "terminal",
});
});
it("uses WSL settings when WSL conflict resolver is configured", () => {
expect(
readConflictResolverSettingsForProject("wsl", {
...settings,
wslConflictResolverProvider: "cursor",
wslConflictResolverModel: "composer-2.5-fast",
wslConflictResolverPresentationMode: "terminal",
}),
).toEqual({
provider: "cursor",
model: "composer-2.5-fast",
effort: "",
presentationMode: "terminal",
});
});
it("uses WSL settings for SSH projects when WSL conflict resolver is configured", () => {
expect(
readConflictResolverSettingsForProject("ssh", {
...settings,
wslConflictResolverProvider: "cursor",
wslConflictResolverModel: "composer-2.5-fast",
wslConflictResolverPresentationMode: "terminal",
}),
).toEqual({
provider: "cursor",
model: "composer-2.5-fast",
effort: "",
presentationMode: "terminal",
});
});
});
describe("resolveConflictResolverLaunchConfig", () => {
it("keeps an explicit Custom model even when the live probe omits it", () => {
const probeMissingComposer = {
kind: "cursor",
label: "Cursor",
installed: true,
authState: "authenticated",
capabilities: {
models: [{ id: "auto", label: "Auto" }],
efforts: [] as string[],
modelEfforts: {} as Record<string, string[]>,
},
} as AgentStatus;
expect(
resolveConflictResolverLaunchConfig("cursor", probeMissingComposer, "composer-2.5", ""),
).toEqual({ model: "composer-2.5", effort: "" });
expect(resolveConflictResolverConfig(probeMissingComposer, "composer-2.5", "").model).toBe(
"auto",
);
});
it("uses resolved Auto model in Auto provider mode", () => {
expect(resolveConflictResolverLaunchConfig("auto", cursorStatus, "", "")).toEqual({
model: "composer-2.5",
effort: "",
});
});
});