We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 03b7af3 commit 9c56bb6Copy full SHA for 9c56bb6
1 file changed
zod-plugin/tests/runtime.spec.ts
@@ -117,6 +117,13 @@ describe("Zod Runtime Plugin", () => {
117
},
118
);
119
120
+ test("throws when multiple source keys map to the same target", () => {
121
+ const schema = z.object({ a: z.number(), b: z.string() });
122
+ expect(() => schema.remap({ a: "x", b: "x" })).toThrowError(
123
+ /duplicate target keys/,
124
+ );
125
+ });
126
+
127
test("should support a mapping function", () => {
128
const schema = z.object({ user_id: z.string(), name: z.string() });
129
const mappedSchema = schema.remap((shape) => camelize(shape, true));
0 commit comments