Skip to content

Commit b5995dd

Browse files
committed
fix tests
1 parent f1fdcd0 commit b5995dd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

app/tests/src/hooks/useAppUpdates.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,24 @@ describe('useAppUpdates', () => {
4646
});
4747
});
4848

49-
it('shows modal when triggered', () => {
49+
it('shows modal when triggered', async () => {
5050
(checkVersion as jest.Mock).mockResolvedValue({
5151
needsUpdate: true,
5252
url: 'u',
5353
});
54+
5455
const { result } = renderHook(() => useAppUpdates());
56+
57+
// Wait for the async checkVersion to complete first
58+
await waitFor(() => {
59+
expect(result.current[0]).toBe(true);
60+
});
61+
62+
// Now test the modal trigger
5563
act(() => {
5664
result.current[1]();
5765
});
66+
5867
expect(registerModalCallbacks).toHaveBeenCalled();
5968
expect(navigate).toHaveBeenCalledWith('Modal', expect.any(Object));
6069
});

0 commit comments

Comments
 (0)