test: fix testing-library/no-wait-for-multiple-assertions error

Simplify the waitFor calls to only wait for the asynchronously updating
components.
This commit is contained in:
Jacob Kozol 2021-12-06 00:10:57 +01:00 committed by jkozol
parent 20d3928744
commit 6713d279ef

View file

@ -355,17 +355,13 @@ describe('Step Registration', () => {
const registrationRadio = screen.getByLabelText('Embed an activation key and register systems on first boot');
userEvent.click(registrationRadio);
await waitFor(() => {
const organizationId = screen.getByLabelText('Organization ID');
expect(organizationId).toHaveValue('5');
expect(organizationId).toBeDisabled();
// can't getByLabelText b/c the label contains an extra <span>
// with a `*` to denote required
const activationKey = screen.getByTestId('subscription-activation');
expect(activationKey).toHaveValue('');
expect(activationKey).toBeEnabled();
// expect(activationKey).toBeRequired(); DDF does not support required fields
});
const organizationId = await screen.findByLabelText('Organization ID');
expect(organizationId).toHaveValue('5');
expect(organizationId).toBeDisabled();
const activationKey = await screen.findByTestId('subscription-activation');
expect(activationKey).toHaveValue('');
expect(activationKey).toBeEnabled();
userEvent.type(screen.getByTestId('subscription-activation'), '012345678901');
screen.getByRole('button', { name: /Next/ }).click();