@@ -19,6 +19,7 @@ describe('valibot', () => {
19
19
const result = await plugin ( schema , [ ] , { schema : 'valibot' , scalars } , { } ) ;
20
20
expect ( result . content ) . toMatchInlineSnapshot ( `
21
21
"
22
+
22
23
export function PrimitiveInputSchema(): v.GenericSchema<PrimitiveInput> {
23
24
return v.object({
24
25
a: v.string(),
@@ -48,6 +49,7 @@ describe('valibot', () => {
48
49
const result = await plugin ( schema , [ ] , { schema : 'valibot' , scalars } , { } ) ;
49
50
expect ( result . content ) . toMatchInlineSnapshot ( `
50
51
"
52
+
51
53
export function PrimitiveInputSchema(): v.GenericSchema<PrimitiveInput> {
52
54
return v.object({
53
55
a: v.nullish(v.string()),
@@ -76,6 +78,7 @@ describe('valibot', () => {
76
78
const result = await plugin ( schema , [ ] , { schema : 'valibot' , scalars } , { } ) ;
77
79
expect ( result . content ) . toMatchInlineSnapshot ( `
78
80
"
81
+
79
82
export function PrimitiveInputSchema(): v.GenericSchema<PrimitiveInput> {
80
83
return v.object({
81
84
a: v.nullish(v.array(v.nullable(v.string()))),
@@ -105,6 +108,7 @@ describe('valibot', () => {
105
108
const result = await plugin ( schema , [ ] , { schema : 'valibot' , scalars } , { } ) ;
106
109
expect ( result . content ) . toMatchInlineSnapshot ( `
107
110
"
111
+
108
112
export function AInputSchema(): v.GenericSchema<AInput> {
109
113
return v.object({
110
114
b: v.lazy(() => BInputSchema())
@@ -125,4 +129,29 @@ describe('valibot', () => {
125
129
"
126
130
` ) ;
127
131
} )
128
- } )
132
+ it . todo ( 'nested input object' )
133
+ it ( 'enum' , async ( ) => {
134
+ const schema = buildSchema ( /* GraphQL */ `
135
+ enum PageType {
136
+ PUBLIC
137
+ BASIC_AUTH
138
+ }
139
+ input PageInput {
140
+ pageType: PageType!
141
+ }
142
+ ` ) ;
143
+ const scalars = undefined
144
+ const result = await plugin ( schema , [ ] , { schema : 'valibot' , scalars } , { } ) ;
145
+ expect ( result . content ) . toMatchInlineSnapshot ( `
146
+ "
147
+ export const PageTypeSchema = v.enum_(PageType);
148
+
149
+ export function PageInputSchema(): v.GenericSchema<PageInput> {
150
+ return v.object({
151
+ pageType: PageTypeSchema
152
+ })
153
+ }
154
+ "
155
+ ` ) ;
156
+ } )
157
+ } )
0 commit comments