/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
-import 'mocha'
-import * as chai from 'chai'
+import { expect } from 'chai'
+import { wait } from '@shared/core-utils'
+import { VideoPrivacy } from '@shared/models'
import {
cleanupTests,
+ createMultipleServers,
doubleFollow,
- flushAndRunMultipleServers,
- ServerInfo,
+ PeerTubeServer,
setAccessTokensToServers,
- wait,
waitJobs
-} from '@shared/extra-utils'
-import { VideoPrivacy } from '@shared/models'
-
-const expect = chai.expect
+} from '@shared/server-commands'
function in10Seconds () {
const now = new Date()
}
describe('Test video update scheduler', function () {
- let servers: ServerInfo[] = []
+ let servers: PeerTubeServer[] = []
let video2UUID: string
before(async function () {
this.timeout(30000)
// Run servers
- servers = await flushAndRunMultipleServers(2)
+ servers = await createMultipleServers(2)
await setAccessTokensToServers(servers)
}
}
- await servers[0].videosCommand.upload({ attributes })
+ await servers[0].videos.upload({ attributes })
await waitJobs(servers)
})
it('Should not list the video (in privacy mode)', async function () {
for (const server of servers) {
- const { total } = await server.videosCommand.list()
+ const { total } = await server.videos.list()
expect(total).to.equal(0)
}
})
it('Should have my scheduled video in my account videos', async function () {
- const { total, data } = await servers[0].videosCommand.listMyVideos()
+ const { total, data } = await servers[0].videos.listMyVideos()
expect(total).to.equal(1)
const videoFromList = data[0]
- const videoFromGet = await servers[0].videosCommand.getWithToken({ id: videoFromList.uuid })
+ const videoFromGet = await servers[0].videos.getWithToken({ id: videoFromList.uuid })
for (const video of [ videoFromList, videoFromGet ]) {
expect(video.name).to.equal('video 1')
await waitJobs(servers)
for (const server of servers) {
- const { total, data } = await server.videosCommand.list()
+ const { total, data } = await server.videos.list()
expect(total).to.equal(1)
expect(data[0].name).to.equal('video 1')
privacy: VideoPrivacy.PRIVATE
}
- const { uuid } = await servers[0].videosCommand.upload({ attributes })
+ const { uuid } = await servers[0].videos.upload({ attributes })
video2UUID = uuid
await waitJobs(servers)
}
}
- await servers[0].videosCommand.update({ id: video2UUID, attributes })
+ await servers[0].videos.update({ id: video2UUID, attributes })
await waitJobs(servers)
})
it('Should not display the updated video', async function () {
for (const server of servers) {
- const { total } = await server.videosCommand.list()
+ const { total } = await server.videos.list()
expect(total).to.equal(1)
}
})
it('Should have my scheduled updated video in my account videos', async function () {
- const { total, data } = await servers[0].videosCommand.listMyVideos()
+ const { total, data } = await servers[0].videos.listMyVideos()
expect(total).to.equal(2)
const video = data.find(v => v.uuid === video2UUID)
await waitJobs(servers)
for (const server of servers) {
- const { total, data } = await server.videosCommand.list()
+ const { total, data } = await server.videos.list()
expect(total).to.equal(2)
const video = data.find(v => v.uuid === video2UUID)