File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -544,14 +544,14 @@ describe('Find composition', () => {
544
544
expect ( findComposition && findComposition . data . value ) . toContainEqual ( testModel ) ;
545
545
} ) ;
546
546
547
- it ( 'should listen to "patch" & "update" events and remove item from list when query is not matching anymore' , ( ) => {
548
- expect . assertions ( 2 ) ;
547
+ it ( 'should listen to "patch" & "update" events and remove item from list when query is not matching anymore' , async ( ) => {
548
+ expect . assertions ( 4 ) ;
549
549
550
550
// given
551
551
const emitter = eventHelper ( ) ;
552
552
const feathersMock = {
553
553
service : ( ) => ( {
554
- find : jest . fn ( ( ) => testModels ) ,
554
+ find : jest . fn ( ( ) => [ testModel ] ) ,
555
555
on : emitter . on ,
556
556
off : jest . fn ( ) ,
557
557
} ) ,
@@ -564,6 +564,11 @@ describe('Find composition', () => {
564
564
findComposition = useFind ( 'testModels' , ref ( { query : { category : testModel . category } } ) ) ;
565
565
} ) ;
566
566
567
+ // before then to ensure that the previous loading procedure is completed
568
+ await nextTick ( ) ;
569
+ expect ( findComposition && findComposition . isLoading . value ) . toBeFalsy ( ) ;
570
+ expect ( findComposition && findComposition . data . value ) . toStrictEqual ( [ testModel ] ) ;
571
+
567
572
// when
568
573
emitter . emit ( 'updated' , changedTestModel ) ;
569
574
You can’t perform that action at this time.
0 commit comments