File tree Expand file tree Collapse file tree 3 files changed +59
-0
lines changed Expand file tree Collapse file tree 3 files changed +59
-0
lines changed Original file line number Diff line number Diff line change @@ -222,6 +222,26 @@ describe('myzod', () => {
222
222
expect ( result . content ) . toContain ( 'phrase: myzod.string()' ) ;
223
223
} ) ;
224
224
225
+ it ( 'with importFrom & useTypeImports' , async ( ) => {
226
+ const schema = buildSchema ( /* GraphQL */ `
227
+ input Say {
228
+ phrase: String!
229
+ }
230
+ ` ) ;
231
+ const result = await plugin (
232
+ schema ,
233
+ [ ] ,
234
+ {
235
+ schema : 'myzod' ,
236
+ importFrom : './types' ,
237
+ useTypeImports : true ,
238
+ } ,
239
+ { }
240
+ ) ;
241
+ expect ( result . prepend ) . toContain ( "import type { Say } from './types'" ) ;
242
+ expect ( result . content ) . toContain ( 'phrase: myzod.string()' ) ;
243
+ } ) ;
244
+
225
245
it ( 'with enumsAsTypes' , async ( ) => {
226
246
const schema = buildSchema ( /* GraphQL */ `
227
247
enum PageType {
Original file line number Diff line number Diff line change @@ -220,6 +220,25 @@ describe('yup', () => {
220
220
expect ( result . content ) . toContain ( 'phrase: yup.string().defined()' ) ;
221
221
} ) ;
222
222
223
+ it ( 'with importFrom & useTypeImports' , async ( ) => {
224
+ const schema = buildSchema ( /* GraphQL */ `
225
+ input Say {
226
+ phrase: String!
227
+ }
228
+ ` ) ;
229
+ const result = await plugin (
230
+ schema ,
231
+ [ ] ,
232
+ {
233
+ importFrom : './types' ,
234
+ useTypeImports : true ,
235
+ } ,
236
+ { }
237
+ ) ;
238
+ expect ( result . prepend ) . toContain ( "import type { Say } from './types'" ) ;
239
+ expect ( result . content ) . toContain ( 'phrase: yup.string().defined()' ) ;
240
+ } ) ;
241
+
223
242
it ( 'with enumsAsTypes' , async ( ) => {
224
243
const schema = buildSchema ( /* GraphQL */ `
225
244
enum PageType {
Original file line number Diff line number Diff line change @@ -223,6 +223,26 @@ describe('zod', () => {
223
223
expect ( result . content ) . toContain ( 'phrase: z.string()' ) ;
224
224
} ) ;
225
225
226
+ it ( 'with importFrom & useTypeImports' , async ( ) => {
227
+ const schema = buildSchema ( /* GraphQL */ `
228
+ input Say {
229
+ phrase: String!
230
+ }
231
+ ` ) ;
232
+ const result = await plugin (
233
+ schema ,
234
+ [ ] ,
235
+ {
236
+ schema : 'zod' ,
237
+ importFrom : './types' ,
238
+ useTypeImports : true ,
239
+ } ,
240
+ { }
241
+ ) ;
242
+ expect ( result . prepend ) . toContain ( "import type { Say } from './types'" ) ;
243
+ expect ( result . content ) . toContain ( 'phrase: z.string()' ) ;
244
+ } ) ;
245
+
226
246
it ( 'with enumsAsTypes' , async ( ) => {
227
247
const schema = buildSchema ( /* GraphQL */ `
228
248
enum PageType {
You can’t perform that action at this time.
0 commit comments