Skip to content

Commit cb9395f

Browse files
authored
test: align ReservationsPage fetch mocks with cast-after-assignment pattern
1 parent 8bccecd commit cb9395f

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

frontend/src/pages/__tests__/Reservationspage.test.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ describe("ReservationsPage", () => {
2020
beforeEach(() => {
2121
jest.clearAllMocks();
2222
(getAuthStatus as jest.Mock).mockResolvedValue({ authenticated: true });
23-
if (global.fetch) {
24-
(global.fetch as any).mockClear?.();
23+
if (global.fetch && "mockClear" in global.fetch) {
24+
const fetchMock = global.fetch as jest.Mock;
25+
fetchMock.mockClear();
2526
}
2627
});
2728

@@ -125,8 +126,9 @@ describe("ReservationsPage", () => {
125126
fireEvent.click(refreshButton);
126127

127128
// Wait for the second fetch call
129+
const fetchMock = global.fetch as jest.Mock;
128130
await waitFor(() => {
129-
expect((global.fetch as jest.Mock).mock.calls.length).toBeGreaterThan(1);
131+
expect(fetchMock.mock.calls.length).toBeGreaterThan(1);
130132
});
131133
});
132134

0 commit comments

Comments
 (0)