- const search = 'http://localhost:' + servers[0].port + '/w/' + videoServer1UUID
- const res1 = await searchVideo(servers[0].url, search)
- const res2 = await searchVideoWithToken(servers[0].url, search, servers[0].accessToken)
-
- for (const res of [ res1, res2 ]) {
- expect(res.body.total).to.equal(1)
- expect(res.body.data).to.be.an('array')
- expect(res.body.data).to.have.lengthOf(1)
- expect(res.body.data[0].name).to.equal('video 1 on server 1')
+ const search = servers[0].url + '/w/' + videoServer1UUID
+ const body1 = await command.searchVideos({ search })
+ const body2 = await command.searchVideos({ search, token: servers[0].accessToken })
+
+ for (const body of [ body1, body2 ]) {
+ expect(body.total).to.equal(1)
+ expect(body.data).to.be.an('array')
+ expect(body.data).to.have.lengthOf(1)
+ expect(body.data[0].name).to.equal('video 1 on server 1')
+ }
+ })
+
+ it('Should search a local video with a query in URL', async function () {
+ const searches = [
+ servers[0].url + '/w/' + videoServer1UUID,
+ servers[0].url + '/videos/watch/' + videoServer1UUID
+ ]
+
+ for (const search of searches) {
+ for (const token of [ undefined, servers[0].accessToken ]) {
+ const body = await command.searchVideos({ search: search + '?startTime=4', token })
+
+ expect(body.total).to.equal(1)
+ expect(body.data).to.be.an('array')
+ expect(body.data).to.have.lengthOf(1)
+ expect(body.data[0].name).to.equal('video 1 on server 1')
+ }