fix: add another assertion

This commit is contained in:
Simone Taeggi 2025-04-01 10:41:11 +02:00
parent a463a07d2d
commit b93670366e

View File

@ -1,5 +1,5 @@
import { unstable_useDocument } from '@strapi/content-manager/strapi-admin';
import { render as renderRTL, waitFor, server, screen } from '@tests/utils';
import { render as renderRTL, waitFor, server, screen, act } from '@tests/utils';
import { rest } from 'msw';
import { Route, Routes } from 'react-router-dom';
@ -57,28 +57,12 @@ describe('AssigneeSelect', () => {
});
it('renders a select with users, first user is selected', async () => {
jest.mocked(unstable_useDocument).mockReturnValue({
document: {
documentId: '12345',
id: 12345,
['strapi_assignee']: {
id: 1,
firstname: 'John',
lastname: 'Doe',
},
},
isLoading: false,
components: {},
validate: jest.fn(),
getInitialFormValues: jest.fn(),
getTitle: jest.fn(),
refetch: jest.fn(),
});
render();
await waitFor(() => {
const combobox = screen.getByRole('combobox');
expect(combobox).toHaveAttribute('aria-disabled', 'false');
// eslint-disable-next-line testing-library/no-wait-for-multiple-assertions
expect(combobox).toHaveValue('John Doe');
});
});