X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fcli%2Fupdate-host.ts;h=ad56f7b1b4e8cf7dcfba0437cb95181485d14085;hb=28be89161aab245526d64f6fb7dd29391a97fe0a;hp=e31a8415682f7727c4b002b105828fd972b4cf40;hpb=40298b02546e8225dd21bf6048fe7f224aefc32a;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/cli/update-host.ts b/server/tests/cli/update-host.ts index e31a84156..ad56f7b1b 100644 --- a/server/tests/cli/update-host.ts +++ b/server/tests/cli/update-host.ts @@ -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 { @@ -13,7 +16,8 @@ import { ServerInfo, setAccessTokensToServers, uploadVideo, - wait + wait, + getVideo } from '../utils' describe('Test update host scripts', function () { @@ -55,14 +59,22 @@ describe('Test update host scripts', function () { expect(videos).to.have.lengthOf(2) for (const video of videos) { - expect(video.files).to.have.lengthOf(5) + const res2 = await getVideo(server.url, video.id) + const videoDetails: VideoDetails = res2.body + + expect(videoDetails.files).to.have.lengthOf(4) - for (const file of video.files) { + for (const file of videoDetails.files) { expect(file.magnetUri).to.contain('localhost%3A9002%2Ftracker%2Fsocket') expect(file.magnetUri).to.contain('localhost%3A9002%2Fstatic%2Fwebseed%2F') - const torrent = await parseTorrentVideo(server, video.uuid, file.resolutionLabel) - 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') } }