Fix HistoryPage stale appliedQuery effect and add mount query regression test
This commit is contained in:
@@ -28,7 +28,7 @@ vi.mock("../../components/WorldMap", () => ({
|
||||
}));
|
||||
|
||||
vi.mock("../../api/config", () => ({
|
||||
fetchMapColorThresholds: async () => ({
|
||||
fetchMapColorThresholds: () => ({
|
||||
threshold_low: 10,
|
||||
threshold_medium: 50,
|
||||
threshold_high: 100,
|
||||
@@ -74,4 +74,18 @@ describe("HistoryPage", () => {
|
||||
expect(lastQuery).toMatchObject({ origin: "blocklist" });
|
||||
});
|
||||
});
|
||||
|
||||
it("never calls history without the default range on mount", async () => {
|
||||
render(
|
||||
<FluentProvider theme={webLightTheme}>
|
||||
<HistoryPage />
|
||||
</FluentProvider>,
|
||||
);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(lastQuery?.range).toBe("7d");
|
||||
});
|
||||
|
||||
expect(mockUseHistory.mock.calls.every((call) => call[0].range === "7d")).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user