@@ -19,6 +19,7 @@ describe('valibot', () => {
1919 const result = await plugin ( schema , [ ] , { schema : 'valibot' , scalars } , { } ) ;
2020 expect ( result . content ) . toMatchInlineSnapshot ( `
2121 "
22+
2223 export function PrimitiveInputSchema(): v.GenericSchema<PrimitiveInput> {
2324 return v.object({
2425 a: v.string(),
@@ -48,6 +49,7 @@ describe('valibot', () => {
4849 const result = await plugin ( schema , [ ] , { schema : 'valibot' , scalars } , { } ) ;
4950 expect ( result . content ) . toMatchInlineSnapshot ( `
5051 "
52+
5153 export function PrimitiveInputSchema(): v.GenericSchema<PrimitiveInput> {
5254 return v.object({
5355 a: v.nullish(v.string()),
@@ -76,6 +78,7 @@ describe('valibot', () => {
7678 const result = await plugin ( schema , [ ] , { schema : 'valibot' , scalars } , { } ) ;
7779 expect ( result . content ) . toMatchInlineSnapshot ( `
7880 "
81+
7982 export function PrimitiveInputSchema(): v.GenericSchema<PrimitiveInput> {
8083 return v.object({
8184 a: v.nullish(v.array(v.nullable(v.string()))),
@@ -105,6 +108,7 @@ describe('valibot', () => {
105108 const result = await plugin ( schema , [ ] , { schema : 'valibot' , scalars } , { } ) ;
106109 expect ( result . content ) . toMatchInlineSnapshot ( `
107110 "
111+
108112 export function AInputSchema(): v.GenericSchema<AInput> {
109113 return v.object({
110114 b: v.lazy(() => BInputSchema())
@@ -125,4 +129,29 @@ describe('valibot', () => {
125129 "
126130 ` ) ;
127131 } )
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