diff options
author | Chocobozzz <me@florianbigard.com> | 2021-10-20 09:05:43 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-10-20 09:25:44 +0200 |
commit | 978c87e7f58b6673fe60f04f1767bc9e02ea4936 (patch) | |
tree | e7d48735d4099fec8c7732f33e7dadb09c0eac80 /server/tests/api/users/users.ts | |
parent | 7e76cc380040e40a2292a9dc825f037c9b538030 (diff) | |
download | PeerTube-978c87e7f58b6673fe60f04f1767bc9e02ea4936.tar.gz PeerTube-978c87e7f58b6673fe60f04f1767bc9e02ea4936.tar.zst PeerTube-978c87e7f58b6673fe60f04f1767bc9e02ea4936.zip |
Add channel filters for my videos/followers
Diffstat (limited to 'server/tests/api/users/users.ts')
-rw-r--r-- | server/tests/api/users/users.ts | 25 |
1 files changed, 25 insertions, 0 deletions
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 () { | |||
318 | fixture: 'video_short.webm' | 318 | fixture: 'video_short.webm' |
319 | } | 319 | } |
320 | await server.videos.upload({ token: userToken, attributes }) | 320 | await server.videos.upload({ token: userToken, attributes }) |
321 | |||
322 | await server.channels.create({ token: userToken, attributes: { name: 'other_channel' } }) | ||
321 | }) | 323 | }) |
322 | 324 | ||
323 | it('Should have video quota updated', async function () { | 325 | it('Should have video quota updated', async function () { |
@@ -340,6 +342,29 @@ describe('Test users', function () { | |||
340 | expect(video.previewPath).to.not.be.null | 342 | expect(video.previewPath).to.not.be.null |
341 | }) | 343 | }) |
342 | 344 | ||
345 | it('Should be able to filter by channel in my videos', async function () { | ||
346 | const myInfo = await server.users.getMyInfo({ token: userToken }) | ||
347 | const mainChannel = myInfo.videoChannels.find(c => c.name !== 'other_channel') | ||
348 | const otherChannel = myInfo.videoChannels.find(c => c.name === 'other_channel') | ||
349 | |||
350 | { | ||
351 | const { total, data } = await server.videos.listMyVideos({ token: userToken, channelId: mainChannel.id }) | ||
352 | expect(total).to.equal(1) | ||
353 | expect(data).to.have.lengthOf(1) | ||
354 | |||
355 | const video: Video = data[0] | ||
356 | expect(video.name).to.equal('super user video') | ||
357 | expect(video.thumbnailPath).to.not.be.null | ||
358 | expect(video.previewPath).to.not.be.null | ||
359 | } | ||
360 | |||
361 | { | ||
362 | const { total, data } = await server.videos.listMyVideos({ token: userToken, channelId: otherChannel.id }) | ||
363 | expect(total).to.equal(0) | ||
364 | expect(data).to.have.lengthOf(0) | ||
365 | } | ||
366 | }) | ||
367 | |||
343 | it('Should be able to search in my videos', async function () { | 368 | it('Should be able to search in my videos', async function () { |
344 | { | 369 | { |
345 | const { total, data } = await server.videos.listMyVideos({ token: userToken, sort: '-createdAt', search: 'user video' }) | 370 | const { total, data } = await server.videos.listMyVideos({ token: userToken, sort: '-createdAt', search: 'user video' }) |