File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -359,6 +359,26 @@ describe('defineTypeFactory', () => {
359
359
books : readonly [ { readonly id : 'Book-0' ; readonly title : 'ゆゆ式' ; readonly author : undefined } ] ;
360
360
} > ( ) ;
361
361
} ) ;
362
+ it ( 'allow missing fields of nested field' , async ( ) => {
363
+ const BookFactory = defineBookFactory ( {
364
+ defaultFields : {
365
+ id : 'Book-0' ,
366
+ title : 'ゆゆ式' ,
367
+ author : {
368
+ id : 'Author-0' ,
369
+ // missing fields: __typename, name
370
+ } ,
371
+ } ,
372
+ } ) ;
373
+ const book = await BookFactory . build ( ) ;
374
+ expectTypeOf ( book ) . toEqualTypeOf < {
375
+ id : string ;
376
+ title : string ;
377
+ author : {
378
+ id : string ;
379
+ } ;
380
+ } > ( ) ;
381
+ } ) ;
362
382
it ( 'creates fields with sequential id' , async ( ) => {
363
383
const BookFactory = defineBookFactory ( {
364
384
defaultFields : {
You can’t perform that action at this time.
0 commit comments