@@ -462,6 +462,8 @@ describe('approval controller', () => {
462
462
463
463
describe ( 'get' , ( ) => {
464
464
it ( 'gets entry' , ( ) => {
465
+ // We only want to test the stored entity in the controller state hence disabling floating promises here.
466
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
465
467
approvalController . add ( {
466
468
id : 'foo' ,
467
469
origin : 'bar.baz' ,
@@ -481,7 +483,13 @@ describe('approval controller', () => {
481
483
} ) ;
482
484
483
485
it ( 'returns undefined for non-existing entry' , ( ) => {
484
- approvalController . add ( { id : 'foo' , origin : 'bar.baz' , type : 'type' } ) ;
486
+ // We only want to test the stored entity in the controller state hence disabling floating promises here.
487
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
488
+ approvalController . add ( {
489
+ id : 'foo' ,
490
+ origin : 'bar.baz' ,
491
+ type : 'type' ,
492
+ } ) ;
485
493
486
494
expect ( approvalController . get ( 'fizz' ) ) . toBeUndefined ( ) ;
487
495
@@ -495,8 +503,9 @@ describe('approval controller', () => {
495
503
let addWithCatch : ( args : any ) => void ;
496
504
497
505
beforeEach ( ( ) => {
498
- addWithCatch = ( args : any ) =>
506
+ addWithCatch = ( args : any ) => {
499
507
approvalController . add ( args ) . catch ( ( ) => undefined ) ;
508
+ } ;
500
509
} ) ;
501
510
502
511
it ( 'validates input' , ( ) => {
@@ -627,8 +636,9 @@ describe('approval controller', () => {
627
636
it ( 'gets the total approval count' , ( ) => {
628
637
expect ( approvalController . getTotalApprovalCount ( ) ) . toBe ( 0 ) ;
629
638
630
- const addWithCatch = ( args : any ) =>
639
+ const addWithCatch = ( args : any ) => {
631
640
approvalController . add ( args ) . catch ( ( ) => undefined ) ;
641
+ } ;
632
642
633
643
addWithCatch ( { id : '1' , origin : 'origin1' , type : 'type0' } ) ;
634
644
expect ( approvalController . getTotalApprovalCount ( ) ) . toBe ( 1 ) ;
@@ -654,8 +664,9 @@ describe('approval controller', () => {
654
664
} ) ;
655
665
expect ( approvalController . getTotalApprovalCount ( ) ) . toBe ( 0 ) ;
656
666
657
- const addWithCatch = ( args : any ) =>
667
+ const addWithCatch = ( args : any ) => {
658
668
approvalController . add ( args ) . catch ( ( ) => undefined ) ;
669
+ } ;
659
670
660
671
addWithCatch ( { id : '1' , origin : 'origin1' , type : 'type0' } ) ;
661
672
expect ( approvalController . getTotalApprovalCount ( ) ) . toBe ( 1 ) ;
@@ -698,8 +709,14 @@ describe('approval controller', () => {
698
709
) . toThrow ( getInvalidHasTypeError ( ) ) ;
699
710
} ) ;
700
711
701
- it ( 'returns true for existing entry by id' , ( ) => {
702
- approvalController . add ( { id : 'foo' , origin : 'bar.baz' , type : TYPE } ) ;
712
+ it ( 'returns true for existing entry by id' , async ( ) => {
713
+ // We only want to check the stored entity is exist in the state hence disabling floating promises here.
714
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
715
+ approvalController . add ( {
716
+ id : 'foo' ,
717
+ origin : 'bar.baz' ,
718
+ type : TYPE ,
719
+ } ) ;
703
720
704
721
expect ( approvalController . has ( { id : 'foo' } ) ) . toBe ( true ) ;
705
722
} ) ;
0 commit comments