aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/views
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-05-05 14:12:57 +0200
committerChocobozzz <me@florianbigard.com>2022-05-05 14:13:14 +0200
commit49f0468d44468528c2fb2c8b0efd19cdaeeec43d (patch)
tree4fd07d5da74506729a1cbbe67548bfd9c6c76849 /server/tests/api/views
parentf18a060a83d7053897173b2a24fb7984893131c7 (diff)
downloadPeerTube-49f0468d44468528c2fb2c8b0efd19cdaeeec43d.tar.gz
PeerTube-49f0468d44468528c2fb2c8b0efd19cdaeeec43d.tar.zst
PeerTube-49f0468d44468528c2fb2c8b0efd19cdaeeec43d.zip
Add filter by start/end date overall stats in api
Diffstat (limited to 'server/tests/api/views')
-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 })