Skip to content

Commit 1bc9066

Browse files
committed
test: add test for scalars
1 parent 998de88 commit 1bc9066

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/valibot.spec.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,37 @@ describe('valibot', () => {
181181
"
182182
`);
183183
})
184+
it('with scalars', async () => {
185+
const schema = buildSchema(/* GraphQL */ `
186+
input Say {
187+
phrase: Text!
188+
times: Count!
189+
}
190+
scalar Count
191+
scalar Text
192+
`);
193+
const result = await plugin(
194+
schema,
195+
[],
196+
{
197+
schema: 'valibot',
198+
scalars: {
199+
Text: 'string',
200+
Count: 'number',
201+
},
202+
},
203+
{},
204+
);
205+
expect(result.content).toMatchInlineSnapshot(`
206+
"
207+
208+
export function SaySchema(): v.GenericSchema<Say> {
209+
return v.object({
210+
phrase: v.string(),
211+
times: v.number()
212+
})
213+
}
214+
"
215+
`);
216+
});
184217
})

0 commit comments

Comments
 (0)