Repository navigation
Expand file tree
/
Copy pathAddProviderInstanceDialog.test.ts
More file actions
73 lines (64 loc) · 2.18 KB
/
Copy pathAddProviderInstanceDialog.test.ts
File metadata and controls
73 lines (64 loc) · 2.18 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
import { describe, expect, it } from "vite-plus/test";
import {
getProviderIdentityDraft,
resolveAcpRegistryWizardNavigation,
resolveWizardNavigation,
updateProviderIdentityDraft,
} from "./AddProviderInstanceDialog.logic";
describe("resolveWizardNavigation", () => {
const invalidId = { instanceIdError: "Instance ID is required." };
// regression: #2813 the wizard advanced past an invalid instance id
it("blocks Next from Identity to Config while the instance id is invalid", () => {
expect(resolveWizardNavigation(1, 2, 3, invalidId)).toEqual({
kind: "blocked",
step: 1,
error: "Instance ID is required.",
});
});
it("stops a direct Driver-to-Config skip at Identity and surfaces its error", () => {
expect(resolveWizardNavigation(0, 2, 3, invalidId)).toEqual({
kind: "blocked",
step: 1,
error: "Instance ID is required.",
});
});
});
describe("ACP Registry wizard", () => {
it("requires a prepared result or valid manual configuration before Identity", () => {
expect(
resolveAcpRegistryWizardNavigation(0, 1, {
instanceIdError: null,
selectionError: "Select an ACP or configure one manually.",
}),
).toEqual({
kind: "blocked",
step: 0,
error: "Select an ACP or configure one manually.",
});
expect(
resolveAcpRegistryWizardNavigation(0, 1, {
instanceIdError: null,
selectionError: null,
}),
).toEqual({ kind: "navigate", step: 1 });
});
it("keeps registry-prefilled identity separate from other drivers", () => {
const registryDrafts = updateProviderIdentityDraft({}, "acpRegistry", {
label: "Gemini CLI",
instanceIdOverride: "acpRegistry_gemini_cli",
});
expect(getProviderIdentityDraft(registryDrafts, "codex")).toEqual({
label: "",
accentColor: "",
instanceIdOverride: null,
});
const drafts = updateProviderIdentityDraft(registryDrafts, "codex", {
label: "Work",
instanceIdOverride: "codex_work",
});
expect(getProviderIdentityDraft(drafts, "acpRegistry")).toMatchObject({
label: "Gemini CLI",
instanceIdOverride: "acpRegistry_gemini_cli",
});
});
});