]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/live/live.ts
Fix lint
[github/Chocobozzz/PeerTube.git] / server / tests / api / live / live.ts
index d756a02c117ce20ab6c7e4f86bd615a1321010e4..b8c4c1e293390899e53ca4e88a5906bf16a4881f 100644 (file)
@@ -4,12 +4,13 @@ import 'mocha'
 import * as chai from 'chai'
 import { basename, join } from 'path'
 import { ffprobePromise, getVideoStream } from '@server/helpers/ffmpeg'
-import { checkLiveCleanupAfterSave, checkLiveSegmentHash, checkResolutionsInMasterPlaylist, testImage } from '@server/tests/shared'
+import { checkLiveCleanup, checkLiveSegmentHash, checkResolutionsInMasterPlaylist, testImage } from '@server/tests/shared'
 import { wait } from '@shared/core-utils'
 import {
   HttpStatusCode,
   LiveVideo,
   LiveVideoCreate,
+  LiveVideoLatencyMode,
   VideoDetails,
   VideoPrivacy,
   VideoState,
@@ -52,6 +53,9 @@ describe('Test live', function () {
         live: {
           enabled: true,
           allowReplay: true,
+          latencySetting: {
+            enabled: true
+          },
           transcoding: {
             enabled: false
           }
@@ -85,6 +89,7 @@ describe('Test live', function () {
         commentsEnabled: false,
         downloadEnabled: false,
         saveReplay: true,
+        latencyMode: LiveVideoLatencyMode.SMALL_LATENCY,
         privacy: VideoPrivacy.PUBLIC,
         previewfile: 'video_short1-preview.webm.jpg',
         thumbnailfile: 'video_short1.webm.jpg'
@@ -126,11 +131,12 @@ describe('Test live', function () {
           expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live')
           expect(live.streamKey).to.not.be.empty
         } else {
-          expect(live.rtmpUrl).to.be.null
-          expect(live.streamKey).to.be.null
+          expect(live.rtmpUrl).to.not.exist
+          expect(live.streamKey).to.not.exist
         }
 
         expect(live.saveReplay).to.be.true
+        expect(live.latencyMode).to.equal(LiveVideoLatencyMode.SMALL_LATENCY)
       }
     })
 
@@ -175,7 +181,7 @@ describe('Test live', function () {
     it('Should update the live', async function () {
       this.timeout(10000)
 
-      await commands[0].update({ videoId: liveVideoUUID, fields: { saveReplay: false } })
+      await commands[0].update({ videoId: liveVideoUUID, fields: { saveReplay: false, latencyMode: LiveVideoLatencyMode.DEFAULT } })
       await waitJobs(servers)
     })
 
@@ -187,11 +193,12 @@ describe('Test live', function () {
           expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live')
           expect(live.streamKey).to.not.be.empty
         } else {
-          expect(live.rtmpUrl).to.be.null
-          expect(live.streamKey).to.be.null
+          expect(live.rtmpUrl).to.not.exist
+          expect(live.streamKey).to.not.exist
         }
 
         expect(live.saveReplay).to.be.false
+        expect(live.latencyMode).to.equal(LiveVideoLatencyMode.DEFAULT)
       }
     })
 
@@ -576,7 +583,7 @@ describe('Test live', function () {
     it('Should correctly have cleaned up the live files', async function () {
       this.timeout(30000)
 
-      await checkLiveCleanupAfterSave(servers[0], liveVideoId, [ 240, 360, 720 ])
+      await checkLiveCleanup(servers[0], liveVideoId, [ 240, 360, 720 ])
     })
   })