-
Notifications
You must be signed in to change notification settings - Fork 160
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
feat(event): add assertion for indexed dynamic size parameters #413
Changes from 2 commits
13c0d4f
a736696
07bb570
ba98646
ff5772d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import {expect, AssertionError} from 'chai'; | ||
import {BigNumber, Contract, ContractFactory} from 'ethers'; | ||
import {BigNumber, Contract, ContractFactory, ethers} from 'ethers'; | ||
import {MockProvider} from '@ethereum-waffle/provider'; | ||
import {EVENTS_ABI, EVENTS_BYTECODE} from '../contracts/Events'; | ||
|
||
|
@@ -27,7 +27,9 @@ describe('INTEGRATION: Events', () => { | |
}); | ||
|
||
it('Emit two: success', async () => { | ||
await expect(events.emitTwo()).to.emit(events, 'Two'); | ||
await expect( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please format as: await expect(events.emitTwo())
.to.emit(events, 'Two')
.withArgs(2, 'Two'); |
||
events.emitTwo()).to.emit(events, 'Two') | ||
.withArgs(2, 'Two'); | ||
}); | ||
|
||
it('Emit two: fail', async () => { | ||
|
@@ -39,6 +41,15 @@ describe('INTEGRATION: Events', () => { | |
); | ||
}); | ||
|
||
it('Emit index: success', async () => { | ||
const bytes = ethers.utils.hexlify(ethers.utils.toUtf8Bytes('Three')); | ||
const hash = ethers.utils.keccak256(ethers.utils.toUtf8Bytes('Three')); | ||
await expect( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please format as: await expect(events.emitIndex())
.to.emit(events, 'Index')
.withArgs(
hash,
'Three',
bytes,
hash,
'0x00cfbbaf7ddb3a1476767101c12a0162e241fbad2a0162e2410cfbbaf7162123'
) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't it make more sense for the expectation to look like this? .withArgs(
"Three",
"Three",
bytes,
bytes,
'0x00cFBbaF7DDB3a1476767101c12a0162e241fbAD2a0162e2410cFBbaF7162123'
); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes as you can see in the commit that is more or less what i did in the previous commit I will update it. What prettier conf / eslint rules are you using exactly ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sz-piotr done |
||
events.emitIndex()).to.emit(events, 'Index') | ||
.withArgs(hash, | ||
'Three', bytes, hash, '0x00cfbbaf7ddb3a1476767101c12a0162e241fbad2a0162e2410cfbbaf7162123'); | ||
}); | ||
|
||
it('Do not emit one: fail', async () => { | ||
await expect( | ||
expect(events.emitOne()).to.not.emit(events, 'One') | ||
|
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.
Add a newline after
(