Skip to content

Commit 4eaee21

Browse files
committed
Fix RepoRow tests
1 parent f655fab commit 4eaee21

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

extensions/ql-vscode/src/view/variant-analysis/__tests__/RepoRow.spec.tsx

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
import {
2-
act,
3-
render as reactRender,
4-
screen,
5-
waitFor,
6-
} from "@testing-library/react";
1+
import { act, render as reactRender, screen } from "@testing-library/react";
72
import {
83
VariantAnalysisRepoStatus,
94
VariantAnalysisScannedRepositoryDownloadStatus,
@@ -403,15 +398,17 @@ describe(RepoRow.name, () => {
403398
status: VariantAnalysisRepoStatus.InProgress,
404399
});
405400

406-
expect(screen.getByRole("checkbox")).toBeDisabled();
401+
const checkbox = await screen.findByRole("checkbox");
402+
expect(checkbox).toBeDisabled();
407403
});
408404

409405
it("does not allow selecting the item if the item has not been downloaded", async () => {
410406
render({
411407
status: VariantAnalysisRepoStatus.Succeeded,
412408
});
413409

414-
expect(screen.getByRole("checkbox")).toBeDisabled();
410+
const checkbox = await screen.findByRole("checkbox");
411+
expect(checkbox).toBeDisabled();
415412
});
416413

417414
it("does not allow selecting the item if the item has not been downloaded successfully", async () => {
@@ -423,11 +420,8 @@ describe(RepoRow.name, () => {
423420
},
424421
});
425422

426-
// It seems like sometimes the first render doesn't have the checkbox disabled
427-
// Might be related to https://github.com/microsoft/vscode-webview-ui-toolkit/issues/404
428-
await waitFor(() => {
429-
expect(screen.getByRole("checkbox")).toBeDisabled();
430-
});
423+
const checkbox = await screen.findByRole("checkbox");
424+
expect(checkbox).toBeDisabled();
431425
});
432426

433427
it("allows selecting the item if the item has been downloaded", async () => {
@@ -440,6 +434,7 @@ describe(RepoRow.name, () => {
440434
},
441435
});
442436

443-
expect(screen.getByRole("checkbox")).toBeEnabled();
437+
const checkbox = await screen.findByRole("checkbox");
438+
expect(checkbox).toBeEnabled();
444439
});
445440
});

0 commit comments

Comments
 (0)