test(admin): wait for the modal cleanup after deleting a list

This commit is contained in:
tgiachi 2026-11-09 15:34:46 +01:00
commit 1a7d16f8a9

View file

@ -145,8 +145,9 @@ describe('deleting a list', () => {
await user.click(within(dialog).getByRole('button', { name: /^delete$/i }))
expect(await screen.findByRole('heading', { name: /^lists$/i })).toBeInTheDocument()
expect(state.lists.map((l) => l.id)).toEqual([2])
expect(screen.queryByRole('link', { name: 'dev@example.org' })).not.toBeInTheDocument()
expect(screen.getByRole('link', { name: 'news@example.org' })).toBeInTheDocument()
// The overview refetches and the modal's aria-hidden is cleaned up asynchronously: wait for both.
expect(await screen.findByRole('link', { name: 'news@example.org' })).toBeInTheDocument()
await waitFor(() => expect(screen.queryByRole('link', { name: 'dev@example.org' })).not.toBeInTheDocument())
})
it('shows a server error and stays on the page', async () => {