Skip to content

Commit 02eb6f2

Browse files
committed
feat: add test for scalars
1 parent 48d64fa commit 02eb6f2

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/valibot.spec.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,39 @@ describe('valibot', () => {
147147
"
148148
`);
149149
})
150+
151+
it('with scalars', async () => {
152+
const schema = buildSchema(/* GraphQL */ `
153+
input Say {
154+
phrase: Text!
155+
times: Count!
156+
}
157+
158+
scalar Count
159+
scalar Text
160+
`);
161+
const result = await plugin(
162+
schema,
163+
[],
164+
{
165+
schema: 'valibot',
166+
scalars: {
167+
Text: 'string',
168+
Count: 'number',
169+
},
170+
},
171+
{},
172+
);
173+
expect(result.content).toMatchInlineSnapshot(`
174+
"
175+
176+
export function SaySchema() {
177+
return v.object({
178+
phrase: v.string(),
179+
times: v.number()
180+
})
181+
}
182+
"
183+
`);
184+
});
150185
})

0 commit comments

Comments
 (0)