From 978c87e7f58b6673fe60f04f1767bc9e02ea4936 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 20 Oct 2021 09:05:43 +0200 Subject: Add channel filters for my videos/followers --- server/tests/api/users/users.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'server/tests/api/users') diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts index 085d9d870..6c41e7d56 100644 --- a/server/tests/api/users/users.ts +++ b/server/tests/api/users/users.ts @@ -318,6 +318,8 @@ describe('Test users', function () { fixture: 'video_short.webm' } await server.videos.upload({ token: userToken, attributes }) + + await server.channels.create({ token: userToken, attributes: { name: 'other_channel' } }) }) it('Should have video quota updated', async function () { @@ -340,6 +342,29 @@ describe('Test users', function () { expect(video.previewPath).to.not.be.null }) + it('Should be able to filter by channel in my videos', async function () { + const myInfo = await server.users.getMyInfo({ token: userToken }) + const mainChannel = myInfo.videoChannels.find(c => c.name !== 'other_channel') + const otherChannel = myInfo.videoChannels.find(c => c.name === 'other_channel') + + { + const { total, data } = await server.videos.listMyVideos({ token: userToken, channelId: mainChannel.id }) + expect(total).to.equal(1) + expect(data).to.have.lengthOf(1) + + const video: Video = data[0] + expect(video.name).to.equal('super user video') + expect(video.thumbnailPath).to.not.be.null + expect(video.previewPath).to.not.be.null + } + + { + const { total, data } = await server.videos.listMyVideos({ token: userToken, channelId: otherChannel.id }) + expect(total).to.equal(0) + expect(data).to.have.lengthOf(0) + } + }) + it('Should be able to search in my videos', async function () { { const { total, data } = await server.videos.listMyVideos({ token: userToken, sort: '-createdAt', search: 'user video' }) -- cgit v1.2.3