Skip to content

Commit

Permalink
fix: flaky test (#1590)
Browse files Browse the repository at this point in the history
  • Loading branch information
Torres-ssf authored Dec 22, 2023
1 parent 773194c commit 7949bb8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .changeset/wicked-timers-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
14 changes: 10 additions & 4 deletions packages/providers/test/provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,17 @@ describe('Provider', () => {
const { height: latestBlockNumberBeforeProduce } = block;

const amountOfBlocksToProduce = 3;
const latestBlockNumber = await provider.produceBlocks(amountOfBlocksToProduce);
await provider.produceBlocks(amountOfBlocksToProduce);

expect(latestBlockNumber.toHex()).toEqual(
latestBlockNumberBeforeProduce.add(amountOfBlocksToProduce).toHex()
);
const blocks = await provider.getBlocks({
last: 20,
});

const lastBlockIndex = blocks.findIndex((b) => b.height.eq(latestBlockNumberBeforeProduce));

const newBlocks = blocks.slice(lastBlockIndex + 1);

expect(newBlocks.length).toBeGreaterThanOrEqual(amountOfBlocksToProduce);
// #endregion Provider-produce-blocks
});

Expand Down

0 comments on commit 7949bb8

Please sign in to comment.