Skip to content

Commit e4c7b4d

Browse files
committed
test: support typesPrefix
1 parent 59bd054 commit e4c7b4d

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

tests/valibot.spec.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,39 @@ describe('valibot', () => {
433433
"
434434
`)
435435
});
436-
it.todo('with typesPrefix')
436+
it('with typesPrefix', async () => {
437+
const schema = buildSchema(/* GraphQL */ `
438+
input Say {
439+
phrase: String!
440+
}
441+
`);
442+
const result = await plugin(
443+
schema,
444+
[],
445+
{
446+
schema: 'valibot',
447+
typesPrefix: 'I',
448+
importFrom: './types',
449+
},
450+
{},
451+
);
452+
expect(result.prepend).toMatchInlineSnapshot(`
453+
[
454+
"import * as v from 'valibot'",
455+
"import { ISay } from './types'",
456+
]
457+
`)
458+
expect(result.content).toMatchInlineSnapshot(`
459+
"
460+
461+
export function ISaySchema(): v.GenericSchema<ISay> {
462+
return v.object({
463+
phrase: v.string()
464+
})
465+
}
466+
"
467+
`)
468+
})
437469
it.todo('with typesSuffix')
438470
it.todo('with default input values')
439471
describe('issues #19', () => {

0 commit comments

Comments
 (0)