X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fvideos%2Fvideo-schedule-update.ts;h=204f436116199b2295cba3d79d60aa15dff14174;hb=2291a412d25bd139398ca9e7a5131d0c1e4ffd7d;hp=8b87ea8554f191c8b2377d4ca31125b804b96db8;hpb=2baea0c77cc765f7cbca9c9a2f4272268892a35c;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/videos/video-schedule-update.ts b/server/tests/api/videos/video-schedule-update.ts index 8b87ea855..204f43611 100644 --- a/server/tests/api/videos/video-schedule-update.ts +++ b/server/tests/api/videos/video-schedule-update.ts @@ -1,20 +1,22 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import * as chai from 'chai' import 'mocha' import { VideoPrivacy } from '../../../../shared/models/videos' import { + cleanupTests, doubleFollow, - flushAndRunMultipleServers, getMyVideos, + flushAndRunMultipleServers, + getMyVideos, getVideosList, - killallServers, + getVideoWithToken, ServerInfo, - setAccessTokensToServers, updateVideo, + setAccessTokensToServers, + updateVideo, uploadVideo, wait -} from '../../utils' -import { join } from 'path' -import { waitJobs } from '../../utils/server/jobs' +} from '../../../../shared/extra-utils' +import { waitJobs } from '../../../../shared/extra-utils/server/jobs' const expect = chai.expect @@ -69,17 +71,22 @@ describe('Test video update scheduler', function () { const res = await getMyVideos(servers[0].url, servers[0].accessToken, 0, 5) expect(res.body.total).to.equal(1) - const video = res.body.data[0] - expect(video.name).to.equal('video 1') - expect(video.privacy.id).to.equal(VideoPrivacy.PRIVATE) - expect(new Date(video.scheduledUpdate.updateAt)).to.be.above(new Date()) - expect(video.scheduledUpdate.privacy).to.equal(VideoPrivacy.PUBLIC) + const videoFromList = res.body.data[0] + const res2 = await getVideoWithToken(servers[0].url, servers[0].accessToken, videoFromList.uuid) + const videoFromGet = res2.body + + for (const video of [ videoFromList, videoFromGet ]) { + expect(video.name).to.equal('video 1') + expect(video.privacy.id).to.equal(VideoPrivacy.PRIVATE) + expect(new Date(video.scheduledUpdate.updateAt)).to.be.above(new Date()) + expect(video.scheduledUpdate.privacy).to.equal(VideoPrivacy.PUBLIC) + } }) it('Should wait some seconds and have the video in public privacy', async function () { - this.timeout(20000) + this.timeout(50000) - await wait(10000) + await wait(15000) await waitJobs(servers) for (const server of servers) { @@ -144,7 +151,7 @@ describe('Test video update scheduler', function () { it('Should wait some seconds and have the updated video in public privacy', async function () { this.timeout(20000) - await wait(10000) + await wait(15000) await waitJobs(servers) for (const server of servers) { @@ -159,6 +166,6 @@ describe('Test video update scheduler', function () { }) after(async function () { - killallServers(servers) + await cleanupTests(servers) }) })