@@ -31,31 +31,16 @@ describe('Replenishment workbooks store', () => {
3131 expect ( replenishmentWorkBooksStore . canView ( ) ) . toBeFalsy ( ) ;
3232 } ) ;
3333
34- test ( 'expects to be visible after toggling once' , ( ) => {
35- replenishmentWorkBooksStore . toggleView ( ) ;
36- expect ( replenishmentWorkBooksStore . canView ( ) ) . toBeTruthy ( ) ;
37- } ) ;
38-
39- test ( 'expects to be invisible after toggling twice' , ( ) => {
40- replenishmentWorkBooksStore . toggleView ( ) ;
41- replenishmentWorkBooksStore . toggleView ( ) ;
42- expect ( replenishmentWorkBooksStore . canView ( ) ) . toBeFalsy ( ) ;
43- } ) ;
44-
45- test ( 'expects to be visible after toggling three times' , ( ) => {
46- for ( let i = 1 ; i <= 3 ; i ++ ) {
34+ test . each ( [
35+ { toggles : 1 , expected : true } ,
36+ { toggles : 2 , expected : false } ,
37+ { toggles : 3 , expected : true } ,
38+ { toggles : 4 , expected : false } ,
39+ ] ) ( 'expects to be $expected after toggling $toggles times' , ( { toggles, expected } ) => {
40+ for ( let i = 1 ; i <= toggles ; i ++ ) {
4741 replenishmentWorkBooksStore . toggleView ( ) ;
4842 }
49-
50- expect ( replenishmentWorkBooksStore . canView ( ) ) . toBeTruthy ( ) ;
51- } ) ;
52-
53- test ( 'expects to be invisible after toggling four times' , ( ) => {
54- for ( let i = 1 ; i <= 4 ; i ++ ) {
55- replenishmentWorkBooksStore . toggleView ( ) ;
56- }
57-
58- expect ( replenishmentWorkBooksStore . canView ( ) ) . toBeFalsy ( ) ;
43+ expect ( replenishmentWorkBooksStore . canView ( ) ) . toBe ( expected ) ;
5944 } ) ;
6045
6146 // Note: This test is skipped because it is not possible to mock localStorage in JSDOM.
0 commit comments