Skip to content

Commit

Permalink
fix: Fix more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
janjakubnanista committed Feb 14, 2024
1 parent c3cb9ad commit ab8d44b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/devtools-evm-test/test/events/parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ describe('events/parser', () => {
const receipt = await (await parent.emitNoArgEvent()).wait()
expect(parseLogs(receipt, parent)).toMatchSnapshot()
expect(parseLogsWithName(receipt, parent, 'NoArgEvent')).toHaveLength(1)
expect(parseLogsWithName(receipt, child, 'NoArgEvent')).toEqual([])
expect(parseLogsWithName(receipt, child, 'NoArgEvent')).toHaveLength(1)
})

it('child no arg event', async () => {
const receipt = await (await child.emitNoArgEvent()).wait()
expect(parseLogs(receipt, parent)).toMatchSnapshot()
expect(parseLogsWithName(receipt, parent, 'NoArgEvent')).toEqual([]) // only the child should emit the event
expect(parseLogsWithName(receipt, parent, 'NoArgEvent')).toHaveLength(1)
expect(parseLogsWithName(receipt, child, 'NoArgEvent')).toHaveLength(1)
expect(parseLogsWithName(receipt, parallel, 'NoArgEvent')).toEqual([]) // parallel logs should be empty

Expand All @@ -46,11 +46,11 @@ describe('events/parser', () => {
)
})

it('not parse an event with one arg from a different contract', async () => {
it('parse an event with one arg from a different contract', async () => {
await fc.assert(
fc.asyncProperty(fc.integer({ min: 0 }), async (arg) => {
const receipt = await (await child.emitOneArgEvent(arg)).wait()
expect(parseLogsWithName(receipt, parent, 'OneArgEvent')).toEqual([])
expect(parseLogsWithName(receipt, parent, 'OneArgEvent')).toHaveLength(1)
}),
{ numRuns: 10 }
)
Expand All @@ -68,21 +68,21 @@ describe('events/parser', () => {
)
})

it('not parse an event with many args from a different contract', async () => {
it('parse an event with many args from a different contract', async () => {
const eventNameArbitrary = fc.constantFrom('NoArgEvent', 'OneArgEvent', 'FourArgEvent')

await fc.assert(
fc.asyncProperty(fc.integer({ min: 0, max: 10 }), eventNameArbitrary, async (count, name) => {
const receipt = await (await child.emitMany(count)).wait()

expect(parseLogsWithName(receipt, child, name)).toHaveLength(count)
expect(parseLogsWithName(receipt, parent, name)).toEqual([])
expect(parseLogsWithName(receipt, parent, name)).toHaveLength(count)
}),
{ numRuns: 10 }
)
})

it('not parse an event with many args with unknown name from a different contract', async () => {
it('parse an event with many args with unknown name from a different contract', async () => {
await fc.assert(
fc.asyncProperty(fc.integer({ min: 0, max: 10 }), fc.string(), async (count, name) => {
fc.pre(name !== 'NoArgEvent')
Expand All @@ -91,7 +91,7 @@ describe('events/parser', () => {

const receipt = await (await child.emitMany(count)).wait()

expect(parseLogsWithName(receipt, parent, name)).toEqual([])
expect(parseLogsWithName(receipt, parent, name)).toHaveLength(count)
}),
{ numRuns: 10 }
)
Expand Down

0 comments on commit ab8d44b

Please sign in to comment.