@@ -550,7 +550,7 @@ describe(`NodeModel`, () => {
550
550
} )
551
551
} )
552
552
553
- describe ( `prepare nodes caching ` , ( ) => {
553
+ describe ( `materialization ` , ( ) => {
554
554
let resolveBetterTitleMock
555
555
let resolveOtherTitleMock
556
556
beforeEach ( async ( ) => {
@@ -590,12 +590,21 @@ describe(`NodeModel`, () => {
590
590
store . dispatch ( {
591
591
type : `CREATE_TYPES` ,
592
592
payload : [
593
+ typeBuilders . buildInterfaceType ( {
594
+ name : `TestNestedInterface` ,
595
+ fields : {
596
+ foo : { type : `String` } ,
597
+ } ,
598
+ resolveType : value => value . kind ,
599
+ } ) ,
600
+
593
601
typeBuilders . buildObjectType ( {
594
602
name : `TestNested` ,
595
603
fields : {
596
604
foo : { type : `String` } ,
597
605
bar : { type : `String` } ,
598
606
} ,
607
+ interfaces : [ `TestNestedInterface` ] ,
599
608
} ) ,
600
609
601
610
typeBuilders . buildObjectType ( {
@@ -624,6 +633,14 @@ describe(`NodeModel`, () => {
624
633
type : `TestNested` ,
625
634
resolve : source => source . nested ,
626
635
} ,
636
+ arrayWithNulls : {
637
+ type : `[TestNestedInterface]` ,
638
+ resolve : source => [
639
+ null ,
640
+ { kind : `TestNested` , foo : source . id } ,
641
+ undefined ,
642
+ ] ,
643
+ } ,
627
644
} ,
628
645
} ) ,
629
646
] ,
@@ -755,6 +772,23 @@ describe(`NodeModel`, () => {
755
772
expect ( result2 . length ) . toBe ( 1 )
756
773
expect ( result2 [ 0 ] . id ) . toBe ( `id2` )
757
774
} )
775
+
776
+ it ( `handles nulish values within array of interface type` , async ( ) => {
777
+ nodeModel . replaceFiltersCache ( )
778
+ const result = await nodeModel . runQuery (
779
+ {
780
+ query : {
781
+ filter : { arrayWithNulls : { elemMatch : { foo : { eq : `id1` } } } } ,
782
+ } ,
783
+ firstOnly : false ,
784
+ type : `Test` ,
785
+ } ,
786
+ { path : `/` }
787
+ )
788
+ expect ( result ) . toBeTruthy ( )
789
+ expect ( result . length ) . toEqual ( 1 )
790
+ expect ( result [ 0 ] . id ) . toEqual ( `id1` )
791
+ } )
758
792
} )
759
793
760
794
describe ( `node tracking` , ( ) => {
0 commit comments