]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/cli/update-host.ts
Improve create import file job
[github/Chocobozzz/PeerTube.git] / server / tests / cli / update-host.ts
index 4358f28e303914842da63b314893d19d1375eaa6..ad56f7b1b4e8cf7dcfba0437cb95181485d14085 100644 (file)
@@ -1,5 +1,8 @@
+/* tslint:disable:no-unused-expression */
+
 import 'mocha'
 import * as chai from 'chai'
+import { VideoDetails } from '../../../shared/models/videos'
 const expect = chai.expect
 
 import {
@@ -57,7 +60,7 @@ describe('Test update host scripts', function () {
 
     for (const video of videos) {
       const res2 = await getVideo(server.url, video.id)
-      const videoDetails = res2.body
+      const videoDetails: VideoDetails = res2.body
 
       expect(videoDetails.files).to.have.lengthOf(4)
 
@@ -65,8 +68,13 @@ describe('Test update host scripts', function () {
         expect(file.magnetUri).to.contain('localhost%3A9002%2Ftracker%2Fsocket')
         expect(file.magnetUri).to.contain('localhost%3A9002%2Fstatic%2Fwebseed%2F')
 
-        const torrent = await parseTorrentVideo(server, videoDetails.uuid, file.resolution)
-        expect(torrent.announce[0]).to.equal('ws://localhost:9002/tracker/socket')
+        const torrent = await parseTorrentVideo(server, videoDetails.uuid, file.resolution.id)
+        const announceWS = torrent.announce.find(a => a === 'ws://localhost:9002/tracker/socket')
+        expect(announceWS).to.not.be.undefined
+
+        const announceHttp = torrent.announce.find(a => a === 'http://localhost:9002/tracker/announce')
+        expect(announceHttp).to.not.be.undefined
+
         expect(torrent.urlList[0]).to.contain('http://localhost:9002/static/webseed')
       }
     }