X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fserver%2Fstats.ts;h=aaa6c62f7d2a720ff1b7517228514e5b43038662;hb=0e9c48c2edbb3871b0ca3ccd6718f2c99f9760b6;hp=e75089a147aafbb3132a869c25aeb4034efd47c6;hpb=3cd0734fd9b0ff21aaef02317a874e8f1c06e027;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/server/stats.ts b/server/tests/api/server/stats.ts index e75089a14..aaa6c62f7 100644 --- a/server/tests/api/server/stats.ts +++ b/server/tests/api/server/stats.ts @@ -13,15 +13,15 @@ import { uploadVideo, viewVideo, wait -} from '../../utils' -import { flushTests, setAccessTokensToServers } from '../../utils/index' -import { getStats } from '../../utils/server/stats' -import { addVideoCommentThread } from '../../utils/videos/video-comments' -import { waitJobs } from '../../utils/server/jobs' +} from '../../../../shared/utils' +import { flushTests, setAccessTokensToServers } from '../../../../shared/utils/index' +import { getStats } from '../../../../shared/utils/server/stats' +import { addVideoCommentThread } from '../../../../shared/utils/videos/video-comments' +import { waitJobs } from '../../../../shared/utils/server/jobs' const expect = chai.expect -describe('Test stats', function () { +describe('Test stats (excluding redundancy)', function () { let servers: ServerInfo[] = [] before(async function () { @@ -39,13 +39,16 @@ describe('Test stats', function () { } await createUser(servers[0].url, servers[0].accessToken, user.username, user.password) - const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, {}) + const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { fixture: 'video_short.webm' }) const videoUUID = resVideo.body.video.uuid await addVideoCommentThread(servers[0].url, servers[0].accessToken, videoUUID, 'comment') await viewVideo(servers[0].url, videoUUID) + // Wait the video views repeatable job + await wait(8000) + await follow(servers[2].url, [ servers[0].url ], servers[2].accessToken) await waitJobs(servers) }) @@ -57,6 +60,7 @@ describe('Test stats', function () { expect(data.totalLocalVideoComments).to.equal(1) expect(data.totalLocalVideos).to.equal(1) expect(data.totalLocalVideoViews).to.equal(1) + expect(data.totalLocalVideoFilesSize).to.equal(218910) expect(data.totalUsers).to.equal(2) expect(data.totalVideoComments).to.equal(1) expect(data.totalVideos).to.equal(1) @@ -71,6 +75,7 @@ describe('Test stats', function () { expect(data.totalLocalVideoComments).to.equal(0) expect(data.totalLocalVideos).to.equal(0) expect(data.totalLocalVideoViews).to.equal(0) + expect(data.totalLocalVideoFilesSize).to.equal(0) expect(data.totalUsers).to.equal(1) expect(data.totalVideoComments).to.equal(1) expect(data.totalVideos).to.equal(1)