]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/friends-advanced.js
Fix tests
[github/Chocobozzz/PeerTube.git] / server / tests / api / friends-advanced.js
index 0d24481ef64c79676fbbbb45307bab08a5544796..d433e97d02a78582d5836f2030c77ffb9f60651f 100644 (file)
@@ -1,3 +1,5 @@
+/* eslint-disable no-unused-expressions */
+
 'use strict'
 
 const chai = require('chai')
@@ -29,13 +31,12 @@ describe('Test advanced friends', function () {
   }
 
   function uploadVideo (podNumber, callback) {
-    const name = 'my super video'
-    const description = 'my super description'
-    const tags = [ 'tag1', 'tag2' ]
-    const fixture = 'video_short.webm'
+    const videoAttributes = {
+      tags: [ 'tag1', 'tag2' ]
+    }
     const server = servers[podNumber - 1]
 
-    return videosUtils.uploadVideo(server.url, server.accessToken, name, description, tags, fixture, callback)
+    return videosUtils.uploadVideo(server.url, server.accessToken, videoAttributes, callback)
   }
 
   function getVideos (podNumber, callback) {
@@ -86,7 +87,7 @@ describe('Test advanced friends', function () {
         getFriendsList(5, function (err, res) {
           if (err) throw err
 
-          expect(res.body.length).to.equal(0)
+          expect(res.body.data.length).to.equal(0)
 
           done()
         })
@@ -111,7 +112,7 @@ describe('Test advanced friends', function () {
           getFriendsList(i, function (err, res) {
             if (err) throw err
 
-            expect(res.body.length).to.equal(0)
+            expect(res.body.data.length).to.equal(0)
 
             callback()
           })
@@ -140,7 +141,7 @@ describe('Test advanced friends', function () {
           getFriendsList(i, function (err, res) {
             if (err) throw err
 
-            expect(res.body.length).to.equal(3)
+            expect(res.body.data.length).to.equal(3)
 
             callback()
           })
@@ -168,7 +169,7 @@ describe('Test advanced friends', function () {
         uploadVideo(2, next)
       },
       function (next) {
-        setTimeout(next, 11000)
+        setTimeout(next, 22000)
       },
       // Rerun server 4
       function (next) {
@@ -182,7 +183,7 @@ describe('Test advanced friends', function () {
           if (err) throw err
 
           // Pod 4 didn't know pod 1 and 2 removed it
-          expect(res.body.length).to.equal(3)
+          expect(res.body.data.length).to.equal(3)
           next()
         })
       },
@@ -200,10 +201,10 @@ describe('Test advanced friends', function () {
           if (err) throw err
 
           // Pod 4 should not be our friend
-          const result = res.body
+          const result = res.body.data
           expect(result.length).to.equal(3)
           for (const pod of result) {
-            expect(pod.url).not.equal(servers[3].url)
+            expect(pod.host).not.equal(servers[3].host)
           }
 
           done()