aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2021-02-02 12:59:41 +0100
committerChocobozzz <chocobozzz@cpy.re>2021-02-04 09:04:47 +0100
commit3d4e112d16471703f51a542c0cc6e73a6f5db628 (patch)
treecb4a53a50f9bc14a87b62ccfa9d398feb4bbcbc8 /server/tests/api
parentf6267b610145033ee26ca8a4a7c2b97eca65072e (diff)
downloadPeerTube-3d4e112d16471703f51a542c0cc6e73a6f5db628.tar.gz
PeerTube-3d4e112d16471703f51a542c0cc6e73a6f5db628.tar.zst
PeerTube-3d4e112d16471703f51a542c0cc6e73a6f5db628.zip
add best trending strategy based on Reddit's best
inspired from https://www.reddit.com/r/changelog/comments/7spgg0/best_is_the_new_hotness/ this implementation only adds freshness, and doesn't personalize based on subscribed communities yet.
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/check-params/config.ts2
-rw-r--r--server/tests/api/server/config.ts2
-rw-r--r--server/tests/api/videos/single-server.ts8
3 files changed, 10 insertions, 2 deletions
diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts
index e6309b5f7..d6c20f7af 100644
--- a/server/tests/api/check-params/config.ts
+++ b/server/tests/api/check-params/config.ts
@@ -141,7 +141,7 @@ describe('Test config API validators', function () {
141 trending: { 141 trending: {
142 videos: { 142 videos: {
143 algorithms: { 143 algorithms: {
144 enabled: [ 'hot', 'most-viewed', 'most-liked' ], 144 enabled: [ 'best', 'hot', 'most-viewed', 'most-liked' ],
145 default: 'most-viewed' 145 default: 'most-viewed'
146 } 146 }
147 } 147 }
diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts
index e5bab0b77..26df8373e 100644
--- a/server/tests/api/server/config.ts
+++ b/server/tests/api/server/config.ts
@@ -375,7 +375,7 @@ describe('Test config', function () {
375 trending: { 375 trending: {
376 videos: { 376 videos: {
377 algorithms: { 377 algorithms: {
378 enabled: [ 'hot', 'most-viewed', 'most-liked' ], 378 enabled: [ 'best', 'hot', 'most-viewed', 'most-liked' ],
379 default: 'hot' 379 default: 'hot'
380 } 380 }
381 } 381 }
diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts
index 52c6800c1..da90223b8 100644
--- a/server/tests/api/videos/single-server.ts
+++ b/server/tests/api/videos/single-server.ts
@@ -363,6 +363,14 @@ describe('Test a single server', function () {
363 expect(videos.length).to.equal(2) 363 expect(videos.length).to.equal(2)
364 }) 364 })
365 365
366 it('Should list and sort by best in descending order', async function () {
367 const res = await getVideosListPagination(server.url, 0, 2, '-best')
368
369 const videos = res.body.data
370 expect(res.body.total).to.equal(6)
371 expect(videos.length).to.equal(2)
372 })
373
366 it('Should update a video', async function () { 374 it('Should update a video', async function () {
367 const attributes = { 375 const attributes = {
368 name: 'my super video updated', 376 name: 'my super video updated',