+ it('Should have the correct active channel stats', async function () {
+ const server = servers[0]
+
+ {
+ const data = await server.stats.get()
+
+ expect(data.totalLocalDailyActiveVideoChannels).to.equal(1)
+ expect(data.totalLocalWeeklyActiveVideoChannels).to.equal(1)
+ expect(data.totalLocalMonthlyActiveVideoChannels).to.equal(1)
+ }
+
+ {
+ const attributes = {
+ name: 'stats_channel',
+ displayName: 'My stats channel'
+ }
+ const created = await server.channels.create({ attributes })
+ channelId = created.id
+
+ const data = await server.stats.get()
+
+ expect(data.totalLocalDailyActiveVideoChannels).to.equal(1)
+ expect(data.totalLocalWeeklyActiveVideoChannels).to.equal(1)
+ expect(data.totalLocalMonthlyActiveVideoChannels).to.equal(1)
+ }
+
+ {
+ await server.videos.upload({ attributes: { fixture: 'video_short.webm', channelId } })
+
+ const data = await server.stats.get()
+
+ expect(data.totalLocalDailyActiveVideoChannels).to.equal(2)
+ expect(data.totalLocalWeeklyActiveVideoChannels).to.equal(2)
+ expect(data.totalLocalMonthlyActiveVideoChannels).to.equal(2)
+ }
+ })
+
+ it('Should have the correct playlist stats', async function () {
+ const server = servers[0]
+
+ {
+ const data = await server.stats.get()
+ expect(data.totalLocalPlaylists).to.equal(0)
+ }
+
+ {
+ await server.playlists.create({
+ attributes: {
+ displayName: 'playlist for count',
+ privacy: VideoPlaylistPrivacy.PUBLIC,
+ videoChannelId: channelId
+ }
+ })
+
+ const data = await server.stats.get()
+ expect(data.totalLocalPlaylists).to.equal(1)
+ }
+ })
+