File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ import { expect , test } from 'vitest' ;
2+
3+ import { replenishmentWorkBooksStore } from '$lib/stores/replenishment_workbook.svelte' ;
4+
5+ describe ( 'Replenishment workbooks store' , ( ) => {
6+ beforeEach ( ( ) => {
7+ replenishmentWorkBooksStore . reset ( ) ;
8+ } ) ;
9+
10+ test ( 'expects to be invisible before toggling' , ( ) => {
11+ expect ( replenishmentWorkBooksStore . canView ( ) ) . toBeFalsy ( ) ;
12+ } ) ;
13+
14+ test ( 'expects to be visible after toggling once' , ( ) => {
15+ replenishmentWorkBooksStore . toggleView ( ) ;
16+ expect ( replenishmentWorkBooksStore . canView ( ) ) . toBeTruthy ( ) ;
17+ } ) ;
18+
19+ test ( 'expects to be invisible after toggling twice' , ( ) => {
20+ replenishmentWorkBooksStore . toggleView ( ) ;
21+ replenishmentWorkBooksStore . toggleView ( ) ;
22+ expect ( replenishmentWorkBooksStore . canView ( ) ) . toBeFalsy ( ) ;
23+ } ) ;
24+
25+ test ( 'expects to be visible after toggling three times' , ( ) => {
26+ for ( let i = 1 ; i <= 3 ; i ++ ) {
27+ replenishmentWorkBooksStore . toggleView ( ) ;
28+ }
29+
30+ expect ( replenishmentWorkBooksStore . canView ( ) ) . toBeTruthy ( ) ;
31+ } ) ;
32+
33+ test ( 'expects to be invisible after toggling four times' , ( ) => {
34+ for ( let i = 1 ; i <= 4 ; i ++ ) {
35+ replenishmentWorkBooksStore . toggleView ( ) ;
36+ }
37+
38+ expect ( replenishmentWorkBooksStore . canView ( ) ) . toBeFalsy ( ) ;
39+ } ) ;
40+ } ) ;
You can’t perform that action at this time.
0 commit comments