aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/views/video-views-overall-stats.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/views/video-views-overall-stats.ts')
-rw-r--r--server/tests/api/views/video-views-overall-stats.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/server/tests/api/views/video-views-overall-stats.ts b/server/tests/api/views/video-views-overall-stats.ts
index 72b072c96..53b8f0d4b 100644
--- a/server/tests/api/views/video-views-overall-stats.ts
+++ b/server/tests/api/views/video-views-overall-stats.ts
@@ -141,6 +141,27 @@ describe('Test views overall stats', function () {
141 } 141 }
142 }) 142 })
143 143
144 it('Should filter overall stats by date', async function () {
145 this.timeout(60000)
146
147 const beforeView = new Date()
148
149 await servers[0].views.simulateViewer({ id: vodVideoId, currentTimes: [ 0, 3 ] })
150 await processViewersStats(servers)
151
152 {
153 const stats = await servers[0].videoStats.getOverallStats({ videoId: vodVideoId, startDate: beforeView.toISOString() })
154 expect(stats.averageWatchTime).to.equal(3)
155 expect(stats.totalWatchTime).to.equal(3)
156 }
157
158 {
159 const stats = await servers[0].videoStats.getOverallStats({ videoId: liveVideoId, endDate: beforeView.toISOString() })
160 expect(stats.averageWatchTime).to.equal(22)
161 expect(stats.totalWatchTime).to.equal(88)
162 }
163 })
164
144 after(async function () { 165 after(async function () {
145 await stopFfmpeg(command) 166 await stopFfmpeg(command)
146 }) 167 })