Skip to content

Commit

Permalink
chore(ci): fix flaky unit test (#2068)
Browse files Browse the repository at this point in the history
This is a quick band-aid to stop sleep from sometimes failing on CI
#2065 (comment)
  • Loading branch information
lidel committed Nov 15, 2022
1 parent 9473d7d commit bd038cd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/bundles/peer-bandwidth.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,12 @@ it('should get bandwidth for added peers', async () => {
bwPeers.forEach(({ bw }) => expect(bw).toBeFalsy())

// Wait for all the bandwdith stats to come in
await sleep(30)
while (bwPeers.some(p => typeof p.bw === 'undefined')) {
await sleep(30)
bwPeers = store.selectPeerBandwidthPeers()
}

// Now all the peers should have had their bandwidth updated
bwPeers = store.selectPeerBandwidthPeers()
expect(bwPeers.length).toBe(peers.length)

bwPeers.forEach(({ bw }) => expect(bw).toBeTruthy())
Expand Down

0 comments on commit bd038cd

Please sign in to comment.