@@ -322,8 +322,82 @@ describe('valibot', () => {
322322 "
323323 ` ) ;
324324 } ) ;
325- it . todo ( 'with notAllowEmptyString' )
326- it . todo ( 'with notAllowEmptyString issue #386' )
325+ it ( 'with notAllowEmptyString' , async ( ) => {
326+ const schema = buildSchema ( /* GraphQL */ `
327+ input PrimitiveInput {
328+ a: ID!
329+ b: String!
330+ c: Boolean!
331+ d: Int!
332+ e: Float!
333+ }
334+ ` ) ;
335+ const result = await plugin (
336+ schema ,
337+ [ ] ,
338+ {
339+ schema : 'valibot' ,
340+ notAllowEmptyString : true ,
341+ scalars : {
342+ ID : 'string' ,
343+ } ,
344+ } ,
345+ { } ,
346+ ) ;
347+ expect ( result . content ) . toMatchInlineSnapshot ( `
348+ "
349+
350+ export function PrimitiveInputSchema(): v.GenericSchema<PrimitiveInput> {
351+ return v.object({
352+ a: v.pipe(v.string(), v.minLength(1)),
353+ b: v.pipe(v.string(), v.minLength(1)),
354+ c: v.boolean(),
355+ d: v.number(),
356+ e: v.number()
357+ })
358+ }
359+ "
360+ ` )
361+ } )
362+ it ( 'with notAllowEmptyString issue #386' , async ( ) => {
363+ const schema = buildSchema ( /* GraphQL */ `
364+ input InputOne {
365+ field: InputNested!
366+ }
367+
368+ input InputNested {
369+ field: String!
370+ }
371+ ` ) ;
372+ const result = await plugin (
373+ schema ,
374+ [ ] ,
375+ {
376+ schema : 'valibot' ,
377+ notAllowEmptyString : true ,
378+ scalars : {
379+ ID : 'string' ,
380+ } ,
381+ } ,
382+ { } ,
383+ ) ;
384+ expect ( result . content ) . toMatchInlineSnapshot ( `
385+ "
386+
387+ export function InputOneSchema(): v.GenericSchema<InputOne> {
388+ return v.object({
389+ field: v.lazy(() => InputNestedSchema())
390+ })
391+ }
392+
393+ export function InputNestedSchema(): v.GenericSchema<InputNested> {
394+ return v.object({
395+ field: v.pipe(v.string(), v.minLength(1))
396+ })
397+ }
398+ "
399+ ` )
400+ } )
327401 it ( 'with scalarSchemas' , async ( ) => {
328402 const schema = buildSchema ( /* GraphQL */ `
329403 input ScalarsInput {
0 commit comments