Skip to content

Commit 998de88

Browse files
committed
test: add test for camelcase
1 parent 0e81efc commit 998de88

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/valibot.spec.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,31 @@ describe('valibot', () => {
154154
"
155155
`);
156156
})
157+
it('camelcase', async () => {
158+
const schema = buildSchema(/* GraphQL */ `
159+
input HTTPInput {
160+
method: HTTPMethod
161+
url: URL!
162+
}
163+
enum HTTPMethod {
164+
GET
165+
POST
166+
}
167+
scalar URL # unknown scalar, should be any
168+
`);
169+
const scalars = undefined
170+
const result = await plugin(schema, [], { schema: 'valibot', scalars }, {});
171+
expect(result.content).toMatchInlineSnapshot(`
172+
"
173+
export const HttpMethodSchema = v.enum_(HttpMethod);
174+
175+
export function HttpInputSchema(): v.GenericSchema<HttpInput> {
176+
return v.object({
177+
method: v.nullish(HttpMethodSchema),
178+
url: v.any()
179+
})
180+
}
181+
"
182+
`);
183+
})
157184
})

0 commit comments

Comments
 (0)