Skip to content

Commit 96e3ce2

Browse files
committed
🚨 Add tests for replenishment workbook (#1726)
1 parent 79b00ae commit 96e3ce2

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
});

0 commit comments

Comments
 (0)