mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 09:36:27 +00:00
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:
@@ -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);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user