-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed as not planned
Description
Hi.
I learned about .rejects function in Jest document example
https://jestjs.io/docs/en/tutorial-async#rejects
here is the example.
// Testing for async errors using `.rejects`.
it('tests error with rejects', () => {
expect.assertions(1);
return expect(user.getUserName(3)).rejects.toEqual({
error: 'User with 3 not found.',
});
});
// Or using async/await with `.rejects`.
it('tests error with async/await and rejects', async () => {
expect.assertions(1);
await expect(user.getUserName(3)).rejects.toEqual({
error: 'User with 3 not found.',
});
});The example used expect.assertions(1);
but, i searched that it is necessary to use assertions with .rejects
then i found this issue 'removed useless expect.assertions'
#7131
so i suggest how about removing expect.assertions(1); code in the example.
becauese i was not sure whether I should used assertions.
thank u.