From 5536c29cb3fa4b7aef860ec97e3d7e53486ce532 Mon Sep 17 00:00:00 2001 From: Joep <145749778+jschuurk-kr@users.noreply.github.com> Date: Mon, 29 Jul 2024 14:03:47 +0200 Subject: [PATCH] adds PollingStationForm test for 404 response on /pollings_stations --- .../PollingStationChoiceForm.test.tsx | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/frontend/app/component/form/polling_station_choice/PollingStationChoiceForm.test.tsx b/frontend/app/component/form/polling_station_choice/PollingStationChoiceForm.test.tsx index 3ed4207bd..49e7e4ad4 100644 --- a/frontend/app/component/form/polling_station_choice/PollingStationChoiceForm.test.tsx +++ b/frontend/app/component/form/polling_station_choice/PollingStationChoiceForm.test.tsx @@ -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( + + + , + ); + + 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(); + }); });