/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
-import 'mocha'
-import * as chai from 'chai'
+import { expect } from 'chai'
import { checkVideoFilesWereRemoved, completeVideoCheck, testImage } from '@server/tests/shared'
import { wait } from '@shared/core-utils'
import { Video, VideoPrivacy } from '@shared/models'
PeerTubeServer,
setAccessTokensToServers,
setDefaultAccountAvatar,
- setDefaultChannelAvatar
+ setDefaultChannelAvatar,
+ waitJobs
} from '@shared/server-commands'
-const expect = chai.expect
-
describe('Test a single server', function () {
function runSuite (mode: 'legacy' | 'resumable') {
it('Should have the views updated', async function () {
this.timeout(20000)
- await server.videos.view({ id: videoId })
- await server.videos.view({ id: videoId })
- await server.videos.view({ id: videoId })
+ await server.views.simulateView({ id: videoId })
+ await server.views.simulateView({ id: videoId })
+ await server.views.simulateView({ id: videoId })
await wait(1500)
- await server.videos.view({ id: videoId })
- await server.videos.view({ id: videoId })
+ await server.views.simulateView({ id: videoId })
+ await server.views.simulateView({ id: videoId })
await wait(1500)
- await server.videos.view({ id: videoId })
- await server.videos.view({ id: videoId })
+ await server.views.simulateView({ id: videoId })
+ await server.views.simulateView({ id: videoId })
- // Wait the repeatable job
- await wait(8000)
+ await server.debug.sendCommand({ body: { command: 'process-video-views-buffer' } })
const video = await server.videos.get({ id: videoId })
expect(video.views).to.equal(3)
it('Should have the video updated', async function () {
this.timeout(60000)
+ await waitJobs([ server ])
+
const video = await server.videos.get({ id: videoId })
await completeVideoCheck(server, video, updateCheckAttributes())