Skip to content

Commit 292bc77

Browse files
committed
1 parent 657f8be commit 292bc77

File tree

3 files changed

+42
-33
lines changed

3 files changed

+42
-33
lines changed

tests/myzod.spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,10 @@ describe('myzod', () => {
508508
date: Date!
509509
email: Email!
510510
}
511+
input UsernameUpdateInput {
512+
updateInputId: ID!
513+
updateName: String!
514+
}
511515
type User {
512516
id: ID!
513517
name: String
@@ -539,6 +543,12 @@ describe('myzod', () => {
539543
Date: 'myzod.date()',
540544
Email: 'myzod.string().email()',
541545
},
546+
scalars: {
547+
ID: {
548+
input: 'number',
549+
output: 'string',
550+
},
551+
},
542552
},
543553
{}
544554
);
@@ -548,6 +558,10 @@ describe('myzod', () => {
548558
'name: myzod.string(),',
549559
'date: myzod.date(),',
550560
'email: myzod.string().email()',
561+
// Username Update Input
562+
'export function UsernameUpdateInputSchema(): myzod.Type<UsernameUpdateInput> {',
563+
'updateInputId: myzod.number(),',
564+
'updateName: myzod.string()',
551565
// User
552566
'export function UserSchema(): myzod.Type<User> {',
553567
"__typename: myzod.literal('User').optional(),",

tests/yup.spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,10 @@ describe('yup', () => {
422422
date: Date!
423423
email: Email!
424424
}
425+
input UsernameUpdateInput {
426+
updateInputId: ID!
427+
updateName: String!
428+
}
425429
type User {
426430
id: ID!
427431
name: String
@@ -454,6 +458,12 @@ describe('yup', () => {
454458
Date: 'yup.date()',
455459
Email: 'yup.string().email()',
456460
},
461+
scalars: {
462+
ID: {
463+
input: 'number',
464+
output: 'string',
465+
},
466+
},
457467
},
458468
{}
459469
);
@@ -463,6 +473,10 @@ describe('yup', () => {
463473
'name: yup.string().defined().nonNullable(),',
464474
'date: yup.date().defined().nonNullable(),',
465475
'email: yup.string().email().defined().nonNullable()',
476+
// Username Update Input
477+
'export function UsernameUpdateInputSchema(): yup.ObjectSchema<UsernameUpdateInput> {',
478+
'updateInputId: yup.number().defined().nonNullable(),',
479+
'updateName: yup.string().defined().nonNullable()',
466480
// User
467481
'export function UserSchema(): yup.ObjectSchema<User> {',
468482
"__typename: yup.string<'User'>().optional(),",

tests/zod.spec.ts

Lines changed: 14 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -511,39 +511,6 @@ describe('zod', () => {
511511
});
512512

513513
describe('with withObjectType', () => {
514-
const schema = buildSchema(/* GraphQL */ `
515-
input ScalarsInput {
516-
date: Date!
517-
email: Email
518-
}
519-
scalar Date
520-
scalar Email
521-
input UserCreateInput {
522-
name: String!
523-
email: Email!
524-
}
525-
type User {
526-
id: ID!
527-
name: String
528-
age: Int
529-
email: Email
530-
isMember: Boolean
531-
createdAt: Date!
532-
}
533-
534-
type Mutation {
535-
_empty: String
536-
}
537-
538-
type Query {
539-
_empty: String
540-
}
541-
542-
type Subscription {
543-
_empty: String
544-
}
545-
`);
546-
547514
it('not generate if withObjectType false', async () => {
548515
const schema = buildSchema(/* GraphQL */ `
549516
type User {
@@ -612,6 +579,10 @@ describe('zod', () => {
612579
date: Date!
613580
email: Email!
614581
}
582+
input UsernameUpdateInput {
583+
updateInputId: ID!
584+
updateName: String!
585+
}
615586
type User {
616587
id: ID!
617588
name: String
@@ -643,6 +614,12 @@ describe('zod', () => {
643614
Date: 'z.date()',
644615
Email: 'z.string().email()',
645616
},
617+
scalars: {
618+
ID: {
619+
input: 'number',
620+
output: 'string',
621+
},
622+
},
646623
},
647624
{}
648625
);
@@ -652,6 +629,10 @@ describe('zod', () => {
652629
'name: z.string(),',
653630
'date: z.date(),',
654631
'email: z.string().email()',
632+
// Username Update Input
633+
'export function UsernameUpdateInputSchema(): z.ZodObject<Properties<UsernameUpdateInput>> {',
634+
'updateInputId: z.number(),',
635+
'updateName: z.string()',
655636
// User
656637
'export function UserSchema(): z.ZodObject<Properties<User>> {',
657638
"__typename: z.literal('User').optional()",

0 commit comments

Comments
 (0)