mirror of https://github.com/Chocobozzz/PeerTube
Add test to search in my videos
parent
1a393a7e23
commit
cca1e13b96
|
@ -309,6 +309,24 @@ describe('Test users', function () {
|
|||
expect(video.thumbnailPath).to.not.be.null
|
||||
expect(video.previewPath).to.not.be.null
|
||||
})
|
||||
|
||||
it('Should be able to search in my videos', async function () {
|
||||
{
|
||||
const res = await getMyVideos(server.url, accessTokenUser, 0, 5, '-createdAt', 'user video')
|
||||
expect(res.body.total).to.equal(1)
|
||||
|
||||
const videos = res.body.data
|
||||
expect(videos).to.have.lengthOf(1)
|
||||
}
|
||||
|
||||
{
|
||||
const res = await getMyVideos(server.url, accessTokenUser, 0, 5, '-createdAt', 'toto')
|
||||
expect(res.body.total).to.equal(0)
|
||||
|
||||
const videos = res.body.data
|
||||
expect(videos).to.have.lengthOf(0)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe('Users listing', function () {
|
||||
|
|
|
@ -161,13 +161,14 @@ function getLocalVideos (url: string) {
|
|||
.expect('Content-Type', /json/)
|
||||
}
|
||||
|
||||
function getMyVideos (url: string, accessToken: string, start: number, count: number, sort?: string) {
|
||||
function getMyVideos (url: string, accessToken: string, start: number, count: number, sort?: string, search?: string) {
|
||||
const path = '/api/v1/users/me/videos'
|
||||
|
||||
const req = request(url)
|
||||
.get(path)
|
||||
.query({ start: start })
|
||||
.query({ count: count })
|
||||
.query({ search: search })
|
||||
|
||||
if (sort) req.query({ sort })
|
||||
|
||||
|
|
Loading…
Reference in New Issue