test: Update tests

After bumping redux from 4.2.1 to 5.0.1 and @reduxjs/toolkit from 1.9.5 to 2.0.1 some tests started to fail. Added async logic solves the issue.
This commit is contained in:
regexowl 2024-01-16 14:32:02 +01:00 committed by Klara Simickova
parent fdad6adb92
commit 0982cbe8db
2 changed files with 8 additions and 8 deletions

View file

@ -183,8 +183,8 @@ describe('Step Upload to Azure', () => {
})
);
// wait for fetching the upload info
expect(await screen.findByTestId('azure-tenant-id-source')).not.toHaveValue(
''
await waitFor(() =>
expect(screen.getByTestId('azure-tenant-id-source')).not.toHaveValue('')
);
await user.click(
@ -212,8 +212,8 @@ describe('Step Upload to Azure', () => {
name: /azureSource1/i,
})
);
expect(await screen.findByTestId('azure-tenant-id-source')).not.toHaveValue(
''
await waitFor(() =>
expect(screen.getByTestId('azure-tenant-id-source')).not.toHaveValue('')
);
await user.click(sourceDropdown);

View file

@ -866,13 +866,13 @@ describe('Step Custom repositories', () => {
expect(firstRepoCheckbox.checked).toEqual(false);
await user.click(firstRepoCheckbox);
expect(firstRepoCheckbox.checked).toEqual(true);
await waitFor(() => expect(firstRepoCheckbox.checked).toEqual(true));
await clickNext();
clickBack();
await clickBack();
firstRepoCheckbox = await getFirstRepoCheckbox();
expect(firstRepoCheckbox.checked).toEqual(true);
await waitFor(() => expect(firstRepoCheckbox.checked).toEqual(true));
});
test('correct number of repositories is fetched', async () => {
@ -1079,7 +1079,7 @@ describe('On Recreate', () => {
const availableRepoCheckbox = await screen.findByRole('checkbox', {
name: /select row 0/i,
});
expect(availableRepoCheckbox).toBeEnabled();
await waitFor(() => expect(availableRepoCheckbox).toBeEnabled());
});
test('with repositories that are no longer available', async () => {