Skip to content

Commit

Permalink
adds PollingStationForm test for 404 response on /pollings_stations
Browse files Browse the repository at this point in the history
  • Loading branch information
jschuurk-kr committed Jul 29, 2024
1 parent c0b9c54 commit 5536c29
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,24 @@ describe("Test PollingStationChoiceForm", () => {
// Check if the error message is visible
expect(screen.getByText("Geen stembureaus gevonden")).toBeVisible();
});

test("Polling station request returns 404", async () => {
overrideOnce("get", "/api/elections/1/polling_stations", 404, {
error: "Resource not found",
});
const user = userEvent.setup();

render(
<PollingStationProvider electionId={1}>
<PollingStationChoiceForm />
</PollingStationProvider>,
);

const openPollingStationList = screen.getByTestId("openPollingStationList");
await user.click(openPollingStationList);
expect(screen.getByText("Kies het stembureau")).toBeVisible();

// Check if the error message is visible
expect(screen.getByText("Geen stembureaus gevonden")).toBeVisible();
});
});

0 comments on commit 5536c29

Please sign in to comment.