diff --git a/services/web/test/frontend/features/project-list/components/table/project-list-table.test.tsx b/services/web/test/frontend/features/project-list/components/table/project-list-table.test.tsx
index f1d4a0755d..f8f9143c16 100644
--- a/services/web/test/frontend/features/project-list/components/table/project-list-table.test.tsx
+++ b/services/web/test/frontend/features/project-list/components/table/project-list-table.test.tsx
@@ -154,17 +154,24 @@ describe('', function () {
})
})
- it('unselects all projects when select all checkbox uchecked', async function () {
+ it('unselects all projects when select all checkbox unchecked', async function () {
renderWithProjectListContext()
await fetchMock.callHistory.flush(true)
const checkbox = await screen.findByLabelText('Select all projects')
- fireEvent.click(checkbox)
+
fireEvent.click(checkbox)
await waitFor(() => {
const allCheckboxes = screen.queryAllByRole('checkbox')
const allCheckboxesChecked = allCheckboxes.filter(c => c.checked)
- expect(allCheckboxesChecked.length).to.equal(0)
+ expect(allCheckboxesChecked).to.have.length(currentProjects.length + 1)
+ })
+
+ fireEvent.click(checkbox)
+
+ await waitFor(() => {
+ const allCheckboxes = screen.queryAllByRole('checkbox')
+ expect(allCheckboxes.every(c => !c.checked)).to.be.true
})
})
@@ -174,12 +181,14 @@ describe('', function () {
const checkbox = await screen.findByLabelText('Select all projects')
fireEvent.click(checkbox)
+ // make sure we are unchecking a project checkbox and that it is already
+ // checked
await waitFor(() => {
expect(
screen
- .getAllByRole('checkbox')[1]
+ .getAllByRole('checkbox', { checked: true })[1]
.getAttribute('data-project-id')
- ).to.exist // make sure we are unchecking a project checkbox
+ ).to.exist
})
fireEvent.click(screen.getAllByRole('checkbox')[1])