From 3d4e112d16471703f51a542c0cc6e73a6f5db628 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Tue, 2 Feb 2021 12:59:41 +0100 Subject: 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. --- server/tests/api/check-params/config.ts | 2 +- server/tests/api/server/config.ts | 2 +- server/tests/api/videos/single-server.ts | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) (limited to 'server/tests') 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 () { trending: { videos: { algorithms: { - enabled: [ 'hot', 'most-viewed', 'most-liked' ], + enabled: [ 'best', 'hot', 'most-viewed', 'most-liked' ], default: 'most-viewed' } } 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 () { trending: { videos: { algorithms: { - enabled: [ 'hot', 'most-viewed', 'most-liked' ], + enabled: [ 'best', 'hot', 'most-viewed', 'most-liked' ], default: 'hot' } } 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 () { expect(videos.length).to.equal(2) }) + it('Should list and sort by best in descending order', async function () { + const res = await getVideosListPagination(server.url, 0, 2, '-best') + + const videos = res.body.data + expect(res.body.total).to.equal(6) + expect(videos.length).to.equal(2) + }) + it('Should update a video', async function () { const attributes = { name: 'my super video updated', -- cgit v1.2.3