aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/video-channels.ts
diff options
context:
space:
mode:
authorFlorian CUNY <poslovitch@bentobox.world>2022-05-31 16:01:11 +0200
committerGitHub <noreply@github.com>2022-05-31 16:01:11 +0200
commitc6f8ca4d6596572de981162983bd02eb2613791d (patch)
treef2ff530c1e1888202d0208837dfc928f1388a6e3 /server/tests/api/videos/video-channels.ts
parentb0185d7351f71bbc5ccbeed5bba86a619a7de70b (diff)
downloadPeerTube-c6f8ca4d6596572de981162983bd02eb2613791d.tar.gz
PeerTube-c6f8ca4d6596572de981162983bd02eb2613791d.tar.zst
PeerTube-c6f8ca4d6596572de981162983bd02eb2613791d.zip
Added "total views" in the my channels list (#5007)
* Added "total views" in the my channels list Implements https://github.com/Chocobozzz/PeerTube/issues/4331 * Fix lint * applied suggested change * updated openAPI spec for the use "withStats" when getting video channels * applied code change * removed GROUP BY in query * Fixed test
Diffstat (limited to 'server/tests/api/videos/video-channels.ts')
-rw-r--r--server/tests/api/videos/video-channels.ts19
1 files changed, 19 insertions, 0 deletions
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts
index 6f495c42d..42e0cf431 100644
--- a/server/tests/api/videos/video-channels.ts
+++ b/server/tests/api/videos/video-channels.ts
@@ -478,6 +478,25 @@ describe('Test video channels', function () {
478 } 478 }
479 }) 479 })
480 480
481 it('Should report correct total views count', async function () {
482 // check if there's the property
483 {
484 const { data } = await servers[0].channels.listByAccount({ accountName, withStats: true })
485
486 for (const channel of data) {
487 expect(channel).to.haveOwnProperty('totalViews')
488 expect(channel.totalViews).to.be.a('number')
489 }
490 }
491
492 // Check if the totalViews count can be updated
493 {
494 const { data } = await servers[0].channels.listByAccount({ accountName, withStats: true })
495 const channelWithView = data.find(channel => channel.id === servers[0].store.channel.id)
496 expect(channelWithView.totalViews).to.equal(2)
497 }
498 })
499
481 it('Should report correct videos count', async function () { 500 it('Should report correct videos count', async function () {
482 const { data } = await servers[0].channels.listByAccount({ accountName, withStats: true }) 501 const { data } = await servers[0].channels.listByAccount({ accountName, withStats: true })
483 502