diff options
author | Chocobozzz <me@florianbigard.com> | 2022-05-18 09:18:39 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-05-18 09:18:39 +0200 |
commit | 305ec384966303bbcedb72b905c5ec4f32d9c7ad (patch) | |
tree | 4e0f722a5f0d4638484cb188c9205e53c11b4e89 /server/tests | |
parent | 0cc253c9719b1e361d33d62adcef4c292cc98be9 (diff) | |
download | PeerTube-305ec384966303bbcedb72b905c5ec4f32d9c7ad.tar.gz PeerTube-305ec384966303bbcedb72b905c5ec4f32d9c7ad.tar.zst PeerTube-305ec384966303bbcedb72b905c5ec4f32d9c7ad.zip |
Add total viewers overall stat
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/views/video-views-overall-stats.ts | 10 |
1 files changed, 10 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 02012388d..25e488b91 100644 --- a/server/tests/api/views/video-views-overall-stats.ts +++ b/server/tests/api/views/video-views-overall-stats.ts | |||
@@ -36,6 +36,7 @@ describe('Test views overall stats', function () { | |||
36 | expect(video.views).to.equal(0) | 36 | expect(video.views).to.equal(0) |
37 | expect(stats.averageWatchTime).to.equal(0) | 37 | expect(stats.averageWatchTime).to.equal(0) |
38 | expect(stats.totalWatchTime).to.equal(0) | 38 | expect(stats.totalWatchTime).to.equal(0) |
39 | expect(stats.totalViewers).to.equal(0) | ||
39 | } | 40 | } |
40 | }) | 41 | }) |
41 | 42 | ||
@@ -55,6 +56,7 @@ describe('Test views overall stats', function () { | |||
55 | expect(video.views).to.equal(0) | 56 | expect(video.views).to.equal(0) |
56 | expect(stats.averageWatchTime).to.equal(1) | 57 | expect(stats.averageWatchTime).to.equal(1) |
57 | expect(stats.totalWatchTime).to.equal(1) | 58 | expect(stats.totalWatchTime).to.equal(1) |
59 | expect(stats.totalViewers).to.equal(1) | ||
58 | } | 60 | } |
59 | }) | 61 | }) |
60 | 62 | ||
@@ -74,6 +76,7 @@ describe('Test views overall stats', function () { | |||
74 | expect(video.views).to.equal(1) | 76 | expect(video.views).to.equal(1) |
75 | expect(stats.averageWatchTime).to.equal(2) | 77 | expect(stats.averageWatchTime).to.equal(2) |
76 | expect(stats.totalWatchTime).to.equal(4) | 78 | expect(stats.totalWatchTime).to.equal(4) |
79 | expect(stats.totalViewers).to.equal(2) | ||
77 | } | 80 | } |
78 | 81 | ||
79 | { | 82 | { |
@@ -83,6 +86,7 @@ describe('Test views overall stats', function () { | |||
83 | expect(video.views).to.equal(1) | 86 | expect(video.views).to.equal(1) |
84 | expect(stats.averageWatchTime).to.equal(21) | 87 | expect(stats.averageWatchTime).to.equal(21) |
85 | expect(stats.totalWatchTime).to.equal(41) | 88 | expect(stats.totalWatchTime).to.equal(41) |
89 | expect(stats.totalViewers).to.equal(2) | ||
86 | } | 90 | } |
87 | } | 91 | } |
88 | }) | 92 | }) |
@@ -103,6 +107,7 @@ describe('Test views overall stats', function () { | |||
103 | expect(video.views).to.equal(1) | 107 | expect(video.views).to.equal(1) |
104 | expect(stats.averageWatchTime).to.equal(2) | 108 | expect(stats.averageWatchTime).to.equal(2) |
105 | expect(stats.totalWatchTime).to.equal(6) | 109 | expect(stats.totalWatchTime).to.equal(6) |
110 | expect(stats.totalViewers).to.equal(3) | ||
106 | } | 111 | } |
107 | 112 | ||
108 | { | 113 | { |
@@ -112,6 +117,7 @@ describe('Test views overall stats', function () { | |||
112 | expect(video.views).to.equal(1) | 117 | expect(video.views).to.equal(1) |
113 | expect(stats.averageWatchTime).to.equal(14) | 118 | expect(stats.averageWatchTime).to.equal(14) |
114 | expect(stats.totalWatchTime).to.equal(43) | 119 | expect(stats.totalWatchTime).to.equal(43) |
120 | expect(stats.totalViewers).to.equal(3) | ||
115 | } | 121 | } |
116 | }) | 122 | }) |
117 | 123 | ||
@@ -129,6 +135,7 @@ describe('Test views overall stats', function () { | |||
129 | expect(video.views).to.equal(2) | 135 | expect(video.views).to.equal(2) |
130 | expect(stats.averageWatchTime).to.equal(3) | 136 | expect(stats.averageWatchTime).to.equal(3) |
131 | expect(stats.totalWatchTime).to.equal(11) | 137 | expect(stats.totalWatchTime).to.equal(11) |
138 | expect(stats.totalViewers).to.equal(4) | ||
132 | } | 139 | } |
133 | 140 | ||
134 | { | 141 | { |
@@ -138,6 +145,7 @@ describe('Test views overall stats', function () { | |||
138 | expect(video.views).to.equal(2) | 145 | expect(video.views).to.equal(2) |
139 | expect(stats.averageWatchTime).to.equal(22) | 146 | expect(stats.averageWatchTime).to.equal(22) |
140 | expect(stats.totalWatchTime).to.equal(88) | 147 | expect(stats.totalWatchTime).to.equal(88) |
148 | expect(stats.totalViewers).to.equal(4) | ||
141 | } | 149 | } |
142 | }) | 150 | }) |
143 | 151 | ||
@@ -153,12 +161,14 @@ describe('Test views overall stats', function () { | |||
153 | const stats = await servers[0].videoStats.getOverallStats({ videoId: vodVideoId, startDate: beforeView.toISOString() }) | 161 | const stats = await servers[0].videoStats.getOverallStats({ videoId: vodVideoId, startDate: beforeView.toISOString() }) |
154 | expect(stats.averageWatchTime).to.equal(3) | 162 | expect(stats.averageWatchTime).to.equal(3) |
155 | expect(stats.totalWatchTime).to.equal(3) | 163 | expect(stats.totalWatchTime).to.equal(3) |
164 | expect(stats.totalViewers).to.equal(1) | ||
156 | } | 165 | } |
157 | 166 | ||
158 | { | 167 | { |
159 | const stats = await servers[0].videoStats.getOverallStats({ videoId: liveVideoId, endDate: beforeView.toISOString() }) | 168 | const stats = await servers[0].videoStats.getOverallStats({ videoId: liveVideoId, endDate: beforeView.toISOString() }) |
160 | expect(stats.averageWatchTime).to.equal(22) | 169 | expect(stats.averageWatchTime).to.equal(22) |
161 | expect(stats.totalWatchTime).to.equal(88) | 170 | expect(stats.totalWatchTime).to.equal(88) |
171 | expect(stats.totalViewers).to.equal(4) | ||
162 | } | 172 | } |
163 | }) | 173 | }) |
164 | 174 | ||