From 6aa541481390980f9c85d2e66514ba0e6ce77a35 Mon Sep 17 00:00:00 2001 From: LoveIsGrief Date: Tue, 24 Sep 2019 08:48:01 +0200 Subject: Autoplay next recommended video (#2137) * Start working on autoplay of next video * Ignore changes made by gitpod * Apply changes from PR#1370 * Correct the spelling of recommendations * Fix linting errors * Move boolean check to existing onEnded handler * Pick a random video until the recommendations are improved * Add simple tests for autoPlayNextVideo * Fix lint ...again --- server/tests/api/check-params/users.ts | 8 ++++++++ server/tests/api/users/users.ts | 13 +++++++++++++ 2 files changed, 21 insertions(+) (limited to 'server/tests') diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts index 9d7ff8984..5d5af284c 100644 --- a/server/tests/api/check-params/users.ts +++ b/server/tests/api/check-params/users.ts @@ -418,6 +418,14 @@ describe('Test users API validators', function () { await makePutBodyRequest({ url: server.url, path: path + 'me', token: userAccessToken, fields }) }) + it('Should fail with an invalid autoPlayNextVideo attribute', async function () { + const fields = { + autoPlayNextVideo: -1 + } + + await makePutBodyRequest({ url: server.url, path: path + 'me', token: userAccessToken, fields }) + }) + it('Should fail with an invalid videosHistoryEnabled attribute', async function () { const fields = { videosHistoryEnabled: -1 diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts index 95b1bb626..ca06942e7 100644 --- a/server/tests/api/users/users.ts +++ b/server/tests/api/users/users.ts @@ -481,6 +481,19 @@ describe('Test users', function () { expect(user.autoPlayVideo).to.be.false }) + it('Should be able to change the autoPlayNextVideo attribute', async function () { + await updateMyUser({ + url: server.url, + accessToken: accessTokenUser, + autoPlayNextVideo: true + }) + + const res = await getMyUserInformation(server.url, accessTokenUser) + const user = res.body + + expect(user.autoPlayNextVideo).to.be.true + }) + it('Should be able to change the email attribute', async function () { await updateMyUser({ url: server.url, -- cgit v1.2.3