/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
-import 'mocha'
-import * as chai from 'chai'
+import { expect } from 'chai'
import { FfmpegCommand } from 'fluent-ffmpeg'
import { prepareViewsServers, prepareViewsVideos, processViewsBuffer } from '@server/tests/shared'
import { wait } from '@shared/core-utils'
import { cleanupTests, PeerTubeServer, stopFfmpeg, waitJobs } from '@shared/server-commands'
-const expect = chai.expect
-
describe('Test video views/viewers counters', function () {
let servers: PeerTubeServer[]
let videoUUID: string
before(async function () {
- this.timeout(30000)
+ this.timeout(120000)
const { uuid } = await servers[0].videos.quickUpload({ name: 'video' })
videoUUID = uuid
})
it('Should not view again this video with the same IP', async function () {
- await servers[0].views.simulateViewer({ id: videoUUID, currentTimes: [ 1, 4 ] })
+ await servers[0].views.simulateViewer({ id: videoUUID, xForwardedFor: '0.0.0.1,127.0.0.1', currentTimes: [ 1, 4 ] })
+ await servers[0].views.simulateViewer({ id: videoUUID, xForwardedFor: '0.0.0.1,127.0.0.1', currentTimes: [ 1, 4 ] })
await processViewsBuffer(servers)
- await checkCounter('views', videoUUID, 1)
+ await checkCounter('views', videoUUID, 2)
})
it('Should view the video from server 2 and send the event', async function () {
await waitJobs(servers)
await processViewsBuffer(servers)
- await checkCounter('views', videoUUID, 2)
+ await checkCounter('views', videoUUID, 3)
})
})
let command: FfmpegCommand
before(async function () {
- this.timeout(60000);
+ this.timeout(120000);
({ vodVideoId, liveVideoId, ffmpegCommand: command } = await prepareViewsVideos({ servers, live: true, vod: true }))
})