utils/monkey-patch: remove try/catch in test

The try/catch would also suppress the fail() which would make the test
always succeed even when it should fail.

Jest has a .rejects API that can be used instead.
This commit is contained in:
David Lechner
2022-02-22 12:32:19 -06:00
parent ed5503f4c7
commit 2f857acbb7
+3 -6
View File
@@ -65,12 +65,9 @@ it.each([false, true])(
await waitForElementToBeRemoved(screen.getByText(testTooltipText));
} else {
// if the patch was not applied, the bug should be triggered
try {
await waitForElementToBeRemoved(screen.getByText(testTooltipText));
fail('bug was not triggered');
} catch (err) {
// error was expected
}
await expect(
waitForElementToBeRemoved(screen.getByText(testTooltipText)),
).rejects.toBeInstanceOf(Error);
}
},
);