-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Add .on('error')
test for reverted contract methods
#6194
Add .on('error')
test for reverted contract methods
#6194
Conversation
Bundle StatsHey there, this message comes from a github action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger No assets were bigger Smaller No assets were smaller Unchanged
|
Deploying with Cloudflare Pages
|
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## 4.x #6194 +/- ##
=======================================
Coverage 87.46% 87.46%
=======================================
Files 197 197
Lines 7557 7557
Branches 2060 2060
=======================================
Hits 6610 6610
Misses 947 947
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
Sounds good.
Just, please, consider the comments.
Thanks,
packages/web3-eth-contract/test/integration/contract_methods_errors.test.ts
Show resolved
Hide resolved
packages/web3-eth-contract/test/integration/contract_methods_errors.test.ts
Outdated
Show resolved
Hide resolved
@@ -75,6 +75,27 @@ describe('contract errors', () => { | |||
}); | |||
}); | |||
|
|||
it('should catch Unauthorized error PromiEvent.on("error")', async () => { | |||
const expectedThrownError = { |
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.
I think it would be nice if we have this const expectedThrownError = {...
above and we use it inside the 2 related test cases which related to the Unauthorized()
error.
@@ -101,5 +122,27 @@ describe('contract errors', () => { | |||
}, | |||
}); | |||
}); | |||
|
|||
it('should catch error with parameter using PromiEvent.on("error")', async () => { | |||
const expectedThrownError = { |
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.
I think it would be nice if we have this const expectedThrownError = {...
above and we use it inside the 2 related test cases which related to the CustomError
error.
…rrors.test.ts Co-authored-by: Muhammad Altabba <24407834+Muhammad-Altabba@users.noreply.github.com>
…rrors.test.ts Co-authored-by: Muhammad Altabba <24407834+Muhammad-Altabba@users.noreply.github.com>
This PR just adds two tests that verify we receive the revert error using
.on('error')
when calling a contract method that revertsrelated to #5670