Skip to content

Commit 2484a06

Browse files
committed
test: add test for importFrom
1 parent 1bc9066 commit 2484a06

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/valibot.spec.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,4 +214,36 @@ describe('valibot', () => {
214214
"
215215
`);
216216
});
217+
it('with importFrom', async () => {
218+
const schema = buildSchema(/* GraphQL */ `
219+
input Say {
220+
phrase: String!
221+
}
222+
`);
223+
const result = await plugin(
224+
schema,
225+
[],
226+
{
227+
schema: 'valibot',
228+
importFrom: './types',
229+
},
230+
{},
231+
);
232+
expect(result.prepend).toMatchInlineSnapshot(`
233+
[
234+
"import * as v from 'valibot'",
235+
"import { Say } from './types'",
236+
]
237+
`);
238+
expect(result.content).toMatchInlineSnapshot(`
239+
"
240+
241+
export function SaySchema(): v.GenericSchema<Say> {
242+
return v.object({
243+
phrase: v.string()
244+
})
245+
}
246+
"
247+
`);
248+
});
217249
})

0 commit comments

Comments
 (0)