1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00

chore: fix failing test; don't rely on a single item only (#6974)

This test is breaking right now because it tests a date picker, week 21
is approaching, and `findByText` only expects a single element. Checking
that we have *at least* one element fixes that breakage and I don't
think it should cause any issues.

Of course, that means that right now, this test would also pass even if
the expected button wasn't there, but it would stop passing in about
four weeks time.
This commit is contained in:
Thomas Heartman 2024-05-02 15:03:49 +02:00 committed by GitHub
parent 5c61667282
commit 44e86fc068
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -55,9 +55,14 @@ describe('FilterDateItem Component', () => {
it('renders initial popover when no existing value', async () => {
const mockState = null;
const recordedChanges = setup(mockState);
setup(mockState);
await screen.findByText('21');
const results = await screen.findAllByText('21');
// In *most* cases, this will probably only be 1, but it *can*
// be more if it's the right time of year (that is: if it
// would also show "week 21").
expect(results.length).toBeGreaterThanOrEqual(1);
});
it('switches operator', async () => {