Skip to content

Commit b609931

Browse files
committed
♻️ Improve SSR test reliability (#1726)
1 parent c1a38ab commit b609931

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/test/lib/stores/replenishment_workbook.test.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,20 @@ describe('Replenishment workbooks store', () => {
5353
expect(mockLocalStorage.setItem).toHaveBeenCalledWith(localStorageKey, JSON.stringify(true));
5454
});
5555

56-
test('handles SSR gracefully', () => {
56+
test('handles invalid localStorage data', () => {
57+
localStorage.setItem(localStorageKey, 'invalid-json');
58+
expect(replenishmentWorkBooksStore.canView()).toBeFalsy();
59+
});
60+
});
61+
62+
describe('Replenishment workbooks store in SSR', () => {
63+
beforeEach(() => {
5764
vi.mock('$app/environment', () => ({
5865
browser: false,
5966
}));
60-
61-
expect(replenishmentWorkBooksStore.canView()).toBeFalsy();
6267
});
6368

64-
test('handles invalid localStorage data', () => {
65-
localStorage.setItem(localStorageKey, 'invalid-json');
69+
test('handles SSR gracefully', () => {
6670
expect(replenishmentWorkBooksStore.canView()).toBeFalsy();
6771
});
6872
});

0 commit comments

Comments
 (0)