Skip to content

Commit ed4aebf

Browse files
committed
Fix mocks
1 parent 8ea2cb0 commit ed4aebf

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

site/jest.setup.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jest.mock("contexts/useProxyLatency", () => ({
1919
useProxyLatency: (proxies?: RegionsResponse) => {
2020
// Must use `useMemo` here to avoid infinite loop.
2121
// Mocking the hook with a hook.
22-
const latencies = useMemo(() => {
22+
const proxyLatencies = useMemo(() => {
2323
if (!proxies) {
2424
return {} as Record<string, ProxyLatencyReport>
2525
}
@@ -35,7 +35,7 @@ jest.mock("contexts/useProxyLatency", () => ({
3535
}, {} as Record<string, ProxyLatencyReport>)
3636
}, [proxies])
3737

38-
return latencies
38+
return {proxyLatencies, refetch: jest.fn() }
3939
},
4040
}))
4141

site/src/contexts/ProxyContext.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import userEvent from "@testing-library/user-event"
2626
// here and not inside a unit test.
2727
jest.mock("contexts/useProxyLatency", () => ({
2828
useProxyLatency: () => {
29-
return hardCodedLatencies
29+
return { proxyLatencies: hardCodedLatencies, refetch: jest.fn() }
3030
},
3131
}))
3232

0 commit comments

Comments
 (0)