






















@@ -408,38 +408,54 @@ describe("config schema", () => {
408408});
409409410410it("rejects allowPrivateNetwork on media-understanding request config", () => {
411-expect(() =>
412-ToolsSchema.parse({
413-media: {
414-image: {
415-models: [
416-{
417-provider: "openai",
418-model: "gpt-4.1-mini",
419-request: {
420-allowPrivateNetwork: true,
421-},
411+const result = ToolsSchema.safeParse({
412+media: {
413+image: {
414+models: [
415+{
416+provider: "openai",
417+model: "gpt-4.1-mini",
418+request: {
419+allowPrivateNetwork: true,
422420},
423-],
424-},
421+},
422+],
425423},
426-}),
427-).toThrow();
424+},
425+});
426+427+expect(result).toMatchObject({ success: false });
428+if (!result.success) {
429+expect(result.error.issues).toContainEqual(
430+expect.objectContaining({
431+keys: ["allowPrivateNetwork"],
432+path: ["media", "image", "models", 0, "request"],
433+}),
434+);
435+}
428436});
429437430438it("rejects unknown keys inside web fetch firecrawl config", () => {
431-expect(() =>
432-ToolsSchema.parse({
433-web: {
434-fetch: {
435-firecrawl: {
436-enabled: true,
437-nope: true,
438-},
439+const result = ToolsSchema.safeParse({
440+web: {
441+fetch: {
442+firecrawl: {
443+enabled: true,
444+nope: true,
439445},
440446},
441-}),
442-).toThrow();
447+},
448+});
449+450+expect(result).toMatchObject({ success: false });
451+if (!result.success) {
452+expect(result.error.issues).toContainEqual(
453+expect.objectContaining({
454+keys: ["nope"],
455+path: ["web", "fetch", "firecrawl"],
456+}),
457+);
458+}
443459});
444460445461it("keeps tags in the allowed taxonomy", () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。