From 4d5f813870683c29af6b9959efa9fd4c4ea5e3b7 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sat, 5 Dec 2015 10:28:27 +0100 Subject: [PATCH] Add tests for searching a video --- test/api/singlePod.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/test/api/singlePod.js b/test/api/singlePod.js index bc9243c1c..301065f39 100644 --- a/test/api/singlePod.js +++ b/test/api/singlePod.js @@ -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) -- 2.41.0