-
-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove ESLint jest/valid-expect-in-promise #426
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly good! The Transaction controller tests need some adjustment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Lots more examples left where an expect
call is in an event handler that may or may not finish before the test ends, but we can fix that separately. I'll add another checklist item for that.
}); | ||
controller.cancelTransaction(controller.state.transactions[0].id); | ||
result.catch((error) => { | ||
expect(error.message).toContain('User rejected the transaction'); | ||
resolve(''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: we don't need to pass anything to resolve
here.
resolve(''); | |
resolve(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bah. I committed this, but now the test fails because the type needs to be adjusted. I'm going to undo this for now - we can fix it some other time.
1382ec8
to
56c1c91
Compare
I decided to go ahead and merge this now, to reduce the chance of future conflicts |
- Add restricted controller messenger ([#378](#378)) - **BREAKING:** Update minimum Node.js version to v12 ([#441](#441)) - **BREAKING:** Replace controller context ([#387](#387)) - Bump @metamask/contract-metadata from 1.23.0 to 1.24.0 ([#440](#440)) - Update lint rules ([#442](#442), [#426](#426)) - Don't remove collectibles during auto detection ([#439](#439))
* refactor catch errors to async await format * finish promise callback removal * restore ordering * promise does not resolve * use listener to ensure expects are called Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* refactor catch errors to async await format * finish promise callback removal * restore ordering * promise does not resolve * use listener to ensure expects are called Co-authored-by: Mark Stacey <markjstacey@gmail.com>
This PR refactors the way the tests catch errors. Currently they are wrapped in promises, but instead it can be refactored to use a jest trick of await expect(function).rejects.toThrow('error message'). Using this trick, we can remove this lint rule.