Add tests for searching a video

pull/10/head
Chocobozzz 2015-12-05 10:28:27 +01:00
parent 19f358b4c0
commit 4d5f813870
1 changed files with 38 additions and 0 deletions

View File

@ -92,6 +92,44 @@
})
})
it('Should search the video', function (done) {
request(url)
.get(path + '/search/my')
.set('Accept', 'application/json')
.expect(200)
.expect('Content-Type', /json/)
.end(function (err, res) {
if (err) throw err
expect(res.body).to.be.an('array')
expect(res.body.length).to.equal(1)
var video = res.body[0]
expect(video.name).to.equal('my super name')
expect(video.description).to.equal('my super description')
expect(video.podUrl).to.equal('http://localhost:9001')
expect(video.magnetUri).to.exist
done()
})
})
it('Should not find a search', function (done) {
request(url)
.get(path + '/search/hello')
.set('Accept', 'application/json')
.expect(200)
.expect('Content-Type', /json/)
.end(function (err, res) {
if (err) throw err
expect(res.body).to.be.an('array')
expect(res.body.length).to.equal(0)
done()
})
})
it('Should remove the video', function (done) {
request(url)
.delete(path + '/' + video_id)