]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - test/api/singlePod.js
Add tests for searching a video
[github/Chocobozzz/PeerTube.git] / test / api / singlePod.js
index bc9243c1c7fb302a926e9a996915157764967fdd..301065f391f18f0082039dbaf91f8f840fbc25bf 100644 (file)
         })
     })
 
+    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)