]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
More robust live test
authorChocobozzz <me@florianbigard.com>
Fri, 27 Nov 2020 12:47:43 +0000 (13:47 +0100)
committerChocobozzz <me@florianbigard.com>
Fri, 27 Nov 2020 14:46:49 +0000 (15:46 +0100)
server/tests/api/live/live.ts

index f99e7ad46649d3b95eeb5a0262ff40d8c1a66a40..843943bba682bbbfbac834c56919d0e17e30709f 100644 (file)
@@ -583,8 +583,8 @@ describe('Test live', function () {
       await waitJobs(servers)
 
       for (const stateChanges of [ localStateChanges, remoteStateChanges ]) {
-        expect(stateChanges).to.have.lengthOf(1)
-        expect(stateChanges[0]).to.equal(VideoState.PUBLISHED)
+        expect(stateChanges).to.have.length.at.least(1)
+        expect(stateChanges[stateChanges.length - 1]).to.equal(VideoState.PUBLISHED)
       }
 
       await stopFfmpeg(command)
@@ -593,8 +593,8 @@ describe('Test live', function () {
       await waitJobs(servers)
 
       for (const stateChanges of [ localStateChanges, remoteStateChanges ]) {
-        expect(stateChanges).to.have.lengthOf(2)
-        expect(stateChanges[1]).to.equal(VideoState.LIVE_ENDED)
+        expect(stateChanges).to.have.length.at.least(2)
+        expect(stateChanges[stateChanges.length - 1]).to.equal(VideoState.LIVE_ENDED)
       }
     })