Skip to content

Commit 360007a

Browse files
authored
Mock local storage in profile page tests (#767)
1 parent 0baae6b commit 360007a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

client/src/pages/profile.test.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,16 @@ describe('Profile page', () => {
118118
courseReviewMock.mockClear();
119119
getReviewsMock.mockReset();
120120
getSubscriptionsMock.mockReset();
121+
122+
Object.defineProperty(window, 'localStorage', {
123+
value: {
124+
getItem: vi.fn(() => null),
125+
setItem: vi.fn(),
126+
removeItem: vi.fn(),
127+
clear: vi.fn(),
128+
},
129+
writable: true,
130+
});
121131
});
122132

123133
it('renders user reviews with scroll attachments', async () => {

0 commit comments

Comments
 (0)