





















@@ -46,7 +46,7 @@ describe("config form renderer", () => {
4646"gateway.auth.token": { label: "Gateway Token", sensitive: true },
4747},
4848unsupportedPaths: analysis.unsupportedPaths,
49-value: {},
49+value: { allowFrom: ["+1"], bind: "auto" },
5050revealSensitive: true,
5151 onPatch,
5252}),
@@ -79,22 +79,6 @@ describe("config form renderer", () => {
7979checkbox.checked = true;
8080checkbox.dispatchEvent(new Event("change", { bubbles: true }));
8181expect(onPatch).toHaveBeenCalledWith(["enabled"], true);
82-});
83-84-it("adds and removes array entries", () => {
85-const onPatch = vi.fn();
86-const container = document.createElement("div");
87-const analysis = rootAnalysis;
88-render(
89-renderConfigForm({
90-schema: analysis.schema,
91-uiHints: {},
92-unsupportedPaths: analysis.unsupportedPaths,
93-value: { allowFrom: ["+1"] },
94- onPatch,
95-}),
96-container,
97-);
98829983const addButton = container.querySelector(".cfg-array__add");
10084expect(addButton).not.toBeUndefined();
@@ -105,22 +89,6 @@ describe("config form renderer", () => {
10589expect(removeButton).not.toBeUndefined();
10690removeButton?.dispatchEvent(new MouseEvent("click", { bubbles: true }));
10791expect(onPatch).toHaveBeenCalledWith(["allowFrom"], []);
108-});
109-110-it("renders union literals as select options", () => {
111-const onPatch = vi.fn();
112-const container = document.createElement("div");
113-const analysis = rootAnalysis;
114-render(
115-renderConfigForm({
116-schema: analysis.schema,
117-uiHints: {},
118-unsupportedPaths: analysis.unsupportedPaths,
119-value: { bind: "auto" },
120- onPatch,
121-}),
122-container,
123-);
1249212593const tailnetButton = Array.from(
12694container.querySelectorAll<HTMLButtonElement>(".cfg-segmented__btn"),
@@ -223,12 +191,7 @@ describe("config form renderer", () => {
223191);
224192expect(tags).toContain("security");
225193expect(tags).toContain("secret");
226-});
227194228-it("filters by tag query", () => {
229-const onPatch = vi.fn();
230-const container = document.createElement("div");
231-const analysis = rootAnalysis;
232195render(
233196renderConfigForm({
234197schema: analysis.schema,
@@ -330,31 +293,27 @@ describe("config form renderer", () => {
330293});
331294332295it("accepts renderable unions", () => {
333-const schema = {
296+const renderableUnionSchema = {
334297type: "object",
335298properties: {
336299mixed: {
337300anyOf: [{ type: "string" }, { type: "object", properties: {} }],
338301},
339302},
340303};
341-const analysis = analyzeConfigSchema(schema);
304+let analysis = analyzeConfigSchema(renderableUnionSchema);
342305expect(analysis.unsupportedPaths).not.toContain("mixed");
343-});
344306345-it("supports nullable types", () => {
346-const schema = {
307+const nullableSchema = {
347308type: "object",
348309properties: {
349310note: { type: ["string", "null"] },
350311},
351312};
352-const analysis = analyzeConfigSchema(schema);
313+analysis = analyzeConfigSchema(nullableSchema);
353314expect(analysis.unsupportedPaths).not.toContain("note");
354-});
355315356-it("ignores untyped additionalProperties schemas", () => {
357-const schema = {
316+const untypedAdditionalPropertiesSchema = {
358317type: "object",
359318properties: {
360319channels: {
@@ -371,7 +330,7 @@ describe("config form renderer", () => {
371330},
372331},
373332};
374-const analysis = analyzeConfigSchema(schema);
333+analysis = analyzeConfigSchema(untypedAdditionalPropertiesSchema);
375334expect(analysis.unsupportedPaths).not.toContain("channels");
376335});
377336此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。