From 68ce17790167ac8ee35f3abe10d1efabe7a13da3 Mon Sep 17 00:00:00 2001 From: Maurice Date: Mon, 14 Sep 2026 14:26:15 +0200 Subject: [PATCH] fix(test): CHARGING-013 failed on a date, not on a count The case asserts no availability counter is shown for an ambiguous station, and looked for one with an unanchored /\d+\/\d+/. The attribution line beside it ends in the source's updatedAt run through toLocaleString(), and tests/setup.ts only forces en-US on toLocaleDateString, so that timestamp reads "14.9.2026" on a German machine and "9/14/2026" on the CI runner. The regex matched the second one. Green where it was written, red on Linux, and red for a reason that has nothing to do with charging. Anchored at the start instead. Both places that print a count begin with it, so the case still says what it meant to say. --- client/src/components/Roadtrip/ChargingInfo.test.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/client/src/components/Roadtrip/ChargingInfo.test.tsx b/client/src/components/Roadtrip/ChargingInfo.test.tsx index 864c3b615..239f4a925 100644 --- a/client/src/components/Roadtrip/ChargingInfo.test.tsx +++ b/client/src/components/Roadtrip/ChargingInfo.test.tsx @@ -70,6 +70,12 @@ describe('Charging information', () => { // request is still out, so a plain findAllByText settles on that one alone and the // count would pass for the wrong reason. await waitFor(() => expect(screen.getAllByText('No reliable data available')).toHaveLength(2)) - expect(screen.queryByText(/\d+\/\d+/)).not.toBeInTheDocument() + // Anchored at the start on purpose. The attribution line ends in the source's + // updatedAt run through toLocaleString(), and tests/setup.ts only forces en-US on + // toLocaleDateString, so that timestamp is "14.9.2026" on a German machine and + // "9/14/2026" on the CI runner. An unanchored \d+/\d+ matches the second one and + // the test fails on Linux for a date, not for a count. Both places that print a + // count start with it, so anchoring keeps what the case is actually about. + expect(screen.queryByText(/^\d+\/\d+/)).not.toBeInTheDocument() }) })