mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 05:26:47 +00:00
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.
This commit is contained in:
@@ -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()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user