

























@@ -213,11 +213,9 @@ describe("config schema", () => {
213213const serialized = JSON.stringify(res);
214214expect(serialized).not.toContain("oversized-marker");
215215const lookup = lookupConfigSchema(res, "plugins.entries.huge.config");
216-expect(lookup?.schema).toMatchObject({
217-type: "object",
218-additionalProperties: true,
219-description: expect.stringContaining("omitted"),
220-});
216+expect(lookup?.schema?.type).toBe("object");
217+expect(lookup?.schema?.additionalProperties).toBe(true);
218+expect(lookup?.schema?.description).toContain("omitted");
221219});
222220223221it("omits later plugin schemas after the aggregate extension schema budget is exhausted", () => {
@@ -239,12 +237,10 @@ describe("config schema", () => {
239237240238const first = lookupConfigSchema(res, "plugins.entries.plugin-0.config.value");
241239const last = lookupConfigSchema(res, "plugins.entries.plugin-39.config");
242-expect(first?.schema).toMatchObject({ type: "string" });
243-expect(last?.schema).toMatchObject({
244-type: "object",
245-additionalProperties: true,
246-description: expect.stringContaining("omitted"),
247-});
240+expect(first?.schema?.type).toBe("string");
241+expect(last?.schema?.type).toBe("object");
242+expect(last?.schema?.additionalProperties).toBe(true);
243+expect(last?.schema?.description).toContain("omitted");
248244});
249245250246it("looks up plugin config paths for slash-delimited plugin ids", () => {
@@ -266,11 +262,10 @@ describe("config schema", () => {
266262const lookup = lookupConfigSchema(res, "plugins.entries.pack/one.config");
267263expect(lookup?.path).toBe("plugins.entries.pack/one.config");
268264expect(lookup?.hintPath).toBe("plugins.entries.pack/one.config");
269-expect(lookup?.children.find((child) => child.key === "provider")).toMatchObject({
270-key: "provider",
271-path: "plugins.entries.pack/one.config.provider",
272-type: "string",
273-});
265+const providerChild = lookup?.children.find((child) => child.key === "provider");
266+expect(providerChild?.key).toBe("provider");
267+expect(providerChild?.path).toBe("plugins.entries.pack/one.config.provider");
268+expect(providerChild?.type).toBe("string");
274269});
275270276271it("adds heartbeat target hints with dynamic channels", () => {
@@ -322,15 +317,13 @@ describe("config schema", () => {
322317});
323318324319expect(parsed?.web?.fetch?.readability).toBe(true);
325-expect(parsed?.web?.fetch).toMatchObject({
326-firecrawl: {
327-enabled: true,
328-apiKey: "firecrawl-test-key",
329-baseUrl: "https://api.firecrawl.dev",
330-onlyMainContent: true,
331-maxAgeMs: 60_000,
332-timeoutSeconds: 15,
333-},
320+expect(parsed?.web?.fetch?.firecrawl).toEqual({
321+enabled: true,
322+apiKey: "firecrawl-test-key",
323+baseUrl: "https://api.firecrawl.dev",
324+onlyMainContent: true,
325+maxAgeMs: 60_000,
326+timeoutSeconds: 15,
334327});
335328});
336329@@ -424,14 +417,15 @@ describe("config schema", () => {
424417},
425418});
426419427-expect(result).toMatchObject({ success: false });
420+expect(result.success).toBe(false);
428421if (!result.success) {
429-expect(result.error.issues).toContainEqual(
430-expect.objectContaining({
431-keys: ["allowPrivateNetwork"],
432-path: ["media", "image", "models", 0, "request"],
433-}),
422+const requestIssue = result.error.issues.find(
423+(issue) =>
424+JSON.stringify(issue.path) === JSON.stringify(["media", "image", "models", 0, "request"]),
434425);
426+expect(requestIssue?.path).toEqual(["media", "image", "models", 0, "request"]);
427+const requestKeys = (requestIssue as { keys?: unknown } | undefined)?.keys;
428+expect(requestKeys).toEqual(["allowPrivateNetwork"]);
435429}
436430});
437431@@ -447,14 +441,14 @@ describe("config schema", () => {
447441},
448442});
449443450-expect(result).toMatchObject({ success: false });
444+expect(result.success).toBe(false);
451445if (!result.success) {
452-expect(result.error.issues).toContainEqual(
453-expect.objectContaining({
454-keys: ["nope"],
455-path: ["web", "fetch", "firecrawl"],
456-}),
446+const firecrawlIssue = result.error.issues.find(
447+(issue) => JSON.stringify(issue.path) === JSON.stringify(["web", "fetch", "firecrawl"]),
457448);
449+expect(firecrawlIssue?.path).toEqual(["web", "fetch", "firecrawl"]);
450+const firecrawlKeys = (firecrawlIssue as { keys?: unknown } | undefined)?.keys;
451+expect(firecrawlKeys).toEqual(["nope"]);
458452}
459453});
460454@@ -518,10 +512,8 @@ describe("config schema", () => {
518512expect(lookup?.path).toBe("agents.list.0.identity.avatar");
519513expect(lookup?.hintPath).toBe("agents.list.*.identity.avatar");
520514expect(lookup?.hint?.help).toContain("workspace-relative path");
521-expect(lookup?.schema).toMatchObject({
522-title: "Identity Avatar",
523-description: expect.stringContaining("Agent avatar"),
524-});
515+expect(lookup?.schema?.title).toBe("Identity Avatar");
516+expect(lookup?.schema?.description).toContain("Agent avatar");
525517});
526518527519it("normalizes bracketed lookup paths", () => {
@@ -555,7 +547,7 @@ describe("config schema", () => {
555547556548const lookup = lookupConfigSchema(tupleSchema, "pair.1");
557549expect(lookup?.path).toBe("pair.1");
558-expect(lookup?.schema).toMatchObject({ type: "number" });
550+expect(lookup?.schema?.type).toBe("number");
559551expect((lookup?.schema as { items?: unknown } | undefined)?.items).toBeUndefined();
560552});
561553此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。