- it('Should make a complex search', async function () {
-
- async function check (search: VideosSearchQuery, exists = true) {
- const body = await command.advancedVideoSearch({ search })
-
- if (exists === false) {
- expect(body.total).to.equal(0)
- expect(body.data).to.have.lengthOf(0)
- return
- }
-
- expect(body.total).to.equal(1)
- expect(body.data).to.have.lengthOf(1)
-
- const video = body.data[0]
-
- expect(video.name).to.equal('What is PeerTube?')
- expect(video.category.label).to.equal('Science & Technology')
- expect(video.licence.label).to.equal('Attribution - Share Alike')
- expect(video.privacy.label).to.equal('Public')
- expect(video.duration).to.equal(113)
- expect(video.thumbnailUrl.startsWith('https://framatube.org/static/thumbnails')).to.be.true
-
- expect(video.account.host).to.equal('framatube.org')
- expect(video.account.name).to.equal('framasoft')
- expect(video.account.url).to.equal('https://framatube.org/accounts/framasoft')
- expect(video.account.avatar).to.exist
-
- expect(video.channel.host).to.equal('framatube.org')
- expect(video.channel.name).to.equal('bf54d359-cfad-4935-9d45-9d6be93f63e8')
- expect(video.channel.url).to.equal('https://framatube.org/video-channels/bf54d359-cfad-4935-9d45-9d6be93f63e8')
- expect(video.channel.avatar).to.exist
- }
-
- const baseSearch: VideosSearchQuery = {
- search: 'what is peertube',
- start: 0,
- count: 2,
- categoryOneOf: [ 15 ],
- licenceOneOf: [ 2 ],
- tagsAllOf: [ 'framasoft', 'peertube' ],
- startDate: '2018-10-01T10:50:46.396Z',
- endDate: '2018-10-01T10:55:46.396Z'
- }
-
- {
- await check(baseSearch)
- }