-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed
Description
🐛 Bug Report
.toThrow() fails to check correctly against an empty string or a string with one symbol.
To Reproduce
it('must fail when compared against an empty string', () => {
expect(() => {
throw 'something';
}).toThrow(''); // PASS
});
it('must fail against a string with one letter', () => {
expect(() => {
throw 'something';
}).toThrow('a'); // PASS
});Expected behavior
The two cases above are supposed to fail. But instead, they both succeed.
Curiously, if in the second case we use more than one letter, only then the test fails.