Skip to content

Commit

Permalink
update test (AcalaNetwork#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
ermalkaleci authored and ns212 committed Apr 3, 2023
1 parent 000424e commit ab990d0
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions e2e/src/block.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,22 @@ describe('block', () => {
dev.newBlock()
}, 1000)
{
const start = Date.now()
// no block is build within 1 sec
// no block is built within 1 sec
await expect(chain.upcomingBlock({ timeout: 1_000 })).rejects.toThrowError('Timeout has occurred')
expect(Date.now() - start).to.be.approximately(1_000, 50)

const next = await chain.upcomingBlock({ timeout: 10_000 })
expect(next.number).toEqual(blockNumber + 6)
}

setTimeout(() => {
dev.newBlock()
}, 1000)
{
// second block is never built
await expect(chain.upcomingBlock({ skipCount: 1, timeout: 10_000 })).rejects.toThrowError('Timeout has occurred')
expect(chain.head.number).toEqual(blockNumber + 7)
}

await delay(1000)
})
})

0 comments on commit ab990d0

Please sign in to comment.