]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/friends-basic.js
Server: adapt tests to host
[github/Chocobozzz/PeerTube.git] / server / tests / api / friends-basic.js
index c91dcb0ce0280db1b2103107f6230fda1c90023d..a871f9838fb5ed911657fbc2310e056a1ad52206 100644 (file)
@@ -22,7 +22,7 @@ describe('Test basic friends', function () {
     const friends = []
     for (let i = 0; i < servers.length; i++) {
       if (servers[i].url === serverToTest.url) continue
-      friends.push(servers[i].url)
+      friends.push(servers[i].host)
     }
 
     podsUtils.getFriendsList(serverToTest.url, function (err, res) {
@@ -32,12 +32,12 @@ describe('Test basic friends', function () {
       expect(result).to.be.an('array')
       expect(result.length).to.equal(2)
 
-      const resultUrls = [ result[0].url, result[1].url ]
-      expect(resultUrls[0]).to.not.equal(resultUrls[1])
+      const resultHosts = [ result[0].host, result[1].host ]
+      expect(resultHosts[0]).to.not.equal(resultHosts[1])
 
-      const errorString = 'Friends url do not correspond for ' + serverToTest.url
-      expect(friends).to.contain(resultUrls[0], errorString)
-      expect(friends).to.contain(resultUrls[1], errorString)
+      const errorString = 'Friends host do not correspond for ' + serverToTest.host
+      expect(friends).to.contain(resultHosts[0], errorString)
+      expect(friends).to.contain(resultHosts[1], errorString)
       callback()
     })
   }
@@ -74,7 +74,7 @@ describe('Test basic friends', function () {
   })
 
   it('Should make friends', function (done) {
-    this.timeout(10000)
+    this.timeout(40000)
 
     series([
       // The second pod make friend with the third
@@ -83,7 +83,7 @@ describe('Test basic friends', function () {
       },
       // Wait for the request between pods
       function (next) {
-        setTimeout(next, 1000)
+        setTimeout(next, 11000)
       },
       // The second pod should have the third as a friend
       function (next) {
@@ -95,7 +95,7 @@ describe('Test basic friends', function () {
           expect(result.length).to.equal(1)
 
           const pod = result[0]
-          expect(pod.url).to.equal(servers[2].url)
+          expect(pod.host).to.equal(servers[2].host)
           expect(pod.score).to.equal(20)
           expect(miscsUtils.dateIsValid(pod.createdDate)).to.be.true
 
@@ -112,7 +112,7 @@ describe('Test basic friends', function () {
           expect(result.length).to.equal(1)
 
           const pod = result[0]
-          expect(pod.url).to.equal(servers[1].url)
+          expect(pod.host).to.equal(servers[1].host)
           expect(pod.score).to.equal(20)
           expect(miscsUtils.dateIsValid(pod.createdDate)).to.be.true
 
@@ -170,7 +170,7 @@ describe('Test basic friends', function () {
             const result = res.body
             expect(result).to.be.an('array')
             expect(result.length).to.equal(1)
-            expect(result[0].url).not.to.be.equal(servers[1].url)
+            expect(result[0].host).not.to.be.equal(servers[1].host)
             callback()
           })
         }, next)
@@ -179,6 +179,8 @@ describe('Test basic friends', function () {
   })
 
   it('Should allow pod 2 to make friend again', function (done) {
+    this.timeout(20000)
+
     const server = servers[1]
     podsUtils.makeFriends(server.url, server.accessToken, function () {
       setTimeout(function () {