Skip to content

Commit 91f915f

Browse files
committed
add test cases
1 parent b0be00c commit 91f915f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

e2e/index.e2e.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,26 @@ describe('defineTypeFactory', () => {
359359
books: readonly [{ readonly id: 'Book-0'; readonly title: 'ゆゆ式'; readonly author: undefined }];
360360
}>();
361361
});
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+
});
362382
it('creates fields with sequential id', async () => {
363383
const BookFactory = defineBookFactory({
364384
defaultFields: {

0 commit comments

Comments
 (0)