]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - test/api/friendsAdvanced.js
Add tests for searching a video
[github/Chocobozzz/PeerTube.git] / test / api / friendsAdvanced.js
index ccddac4dc1623bdd61b9d8ff9a1a9494b339aa30..680d90aee55c8d6f42a4ad0e7fc6af1d8aa8cf89 100644 (file)
     })
 
     it('Should make friends with the pods 1, 2, 3', function (done) {
-      this.timeout(100000)
+      this.timeout(150000)
 
-      // Pods 1, 2, 3 and 4 become friends
+      // Pods 1, 2, 3 and 4 become friends (yes this is beautiful)
       makeFriend(2, function () {
         makeFriend(1, function () {
           makeFriend(4, function () {
 
             // Expulse pod 4 from pod 1 and 2
             uploadVideo(1, function () {
-              uploadVideo(1, function () {
-                uploadVideo(2, function () {
-                  uploadVideo(2, function () {
-                    // Rerun server 4
-                    utils.runServer(4, function (app, url) {
-                      apps[3] = app
-                      getFriendsList(4, function (err, res) {
-                        if (err) throw err
-                        // Pod 4 didn't know pod 1 and 2 removed it
-                        expect(res.body.length).to.equal(3)
-
-                        // Pod 6 ask pod 1, 2 and 3
-                        makeFriend(6, function () {
-                          getFriendsList(6, function (err, res) {
-                            if (err) throw err
-
-                            // Pod 4 should not be our friend
-                            var result = res.body
-                            expect(result.length).to.equal(3)
-                            for (var pod of result) {
-                              expect(pod.url).not.equal(urls[3])
-                            }
-
-                            done()
-                          })
+              setTimeout(function () {
+                uploadVideo(1, function () {
+                  setTimeout(function () {
+                    uploadVideo(2, function () {
+                      setTimeout(function () {
+                        uploadVideo(2, function () {
+                          setTimeout(function () {
+                            // Rerun server 4
+                            utils.runServer(4, function (app, url) {
+                              apps[3] = app
+                              getFriendsList(4, function (err, res) {
+                                if (err) throw err
+                                // Pod 4 didn't know pod 1 and 2 removed it
+                                expect(res.body.length).to.equal(3)
+
+                                // Pod 6 ask pod 1, 2 and 3
+                                makeFriend(6, function () {
+                                  getFriendsList(6, function (err, res) {
+                                    if (err) throw err
+
+                                    // Pod 4 should not be our friend
+                                    var result = res.body
+                                    expect(result.length).to.equal(3)
+                                    for (var pod of result) {
+                                      expect(pod.url).not.equal(urls[3])
+                                    }
+
+                                    done()
+                                  })
+                                })
+                              })
+                            })
+                          }, 11000)
                         })
-                      })
+                      }, 11000)
                     })
-                  })
+                  }, 11000)
                 })
-              })
+              }, 11000)
             })
           })
         })