Skip to content

Commit bd038cd

Browse files
authored
chore(ci): fix flaky unit test (#2068)
This is a quick band-aid to stop sleep from sometimes failing on CI #2065 (comment)
1 parent 9473d7d commit bd038cd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/bundles/peer-bandwidth.test.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,12 @@ it('should get bandwidth for added peers', async () => {
194194
bwPeers.forEach(({ bw }) => expect(bw).toBeFalsy())
195195

196196
// Wait for all the bandwdith stats to come in
197-
await sleep(30)
197+
while (bwPeers.some(p => typeof p.bw === 'undefined')) {
198+
await sleep(30)
199+
bwPeers = store.selectPeerBandwidthPeers()
200+
}
198201

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

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

0 commit comments

Comments
 (0)