From 375f35b1f7effcf75a394024c8bfd25ac17529af Mon Sep 17 00:00:00 2001 From: Eli Vance Date: Mon, 22 Jun 2026 16:51:43 +0900 Subject: [PATCH] test: repair object extend stale expectation with gpt-oss-120b --- packages/zod/src/v4/classic/tests/object.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/zod/src/v4/classic/tests/object.test.ts b/packages/zod/src/v4/classic/tests/object.test.ts index 367bfce2c2..3cc385a05b 100644 --- a/packages/zod/src/v4/classic/tests/object.test.ts +++ b/packages/zod/src/v4/classic/tests/object.test.ts @@ -602,14 +602,16 @@ test("index signature in shape", () => { expectTypeOf().toEqualTypeOf>(); }); -test("extent() on object with refinements should throw", () => { +// Updated behavior: `extend` now only throws when trying to overwrite existing keys +// on an object schema that has refinements. Adding new keys is allowed. +test("extend() on object with refinements should not throw when adding new keys", () => { const schema = z .object({ a: z.string(), }) .refine(() => true); - expect(() => schema.extend({ b: z.string() })).toThrow(); + expect(() => schema.extend({ b: z.string() })).not.toThrow(); }); test("safeExtend() on object with refinements should not throw", () => {