diff options
Diffstat (limited to 'server/tests/api/friendsBasic.js')
-rw-r--r-- | server/tests/api/friendsBasic.js | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/server/tests/api/friendsBasic.js b/server/tests/api/friendsBasic.js index 5b738ad39..c74a7f224 100644 --- a/server/tests/api/friendsBasic.js +++ b/server/tests/api/friendsBasic.js | |||
@@ -1,8 +1,9 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | const async = require('async') | ||
4 | const chai = require('chai') | 3 | const chai = require('chai') |
4 | const each = require('async/each') | ||
5 | const expect = chai.expect | 5 | const expect = chai.expect |
6 | const series = require('async/series') | ||
6 | 7 | ||
7 | const utils = require('./utils') | 8 | const utils = require('./utils') |
8 | 9 | ||
@@ -45,7 +46,7 @@ describe('Test basic friends', function () { | |||
45 | utils.flushAndRunMultipleServers(3, function (serversRun, urlsRun) { | 46 | utils.flushAndRunMultipleServers(3, function (serversRun, urlsRun) { |
46 | servers = serversRun | 47 | servers = serversRun |
47 | 48 | ||
48 | async.each(servers, function (server, callbackEach) { | 49 | each(servers, function (server, callbackEach) { |
49 | utils.loginAndGetAccessToken(server, function (err, accessToken) { | 50 | utils.loginAndGetAccessToken(server, function (err, accessToken) { |
50 | if (err) return callbackEach(err) | 51 | if (err) return callbackEach(err) |
51 | 52 | ||
@@ -57,7 +58,7 @@ describe('Test basic friends', function () { | |||
57 | }) | 58 | }) |
58 | 59 | ||
59 | it('Should not have friends', function (done) { | 60 | it('Should not have friends', function (done) { |
60 | async.each(servers, function (server, callback) { | 61 | each(servers, function (server, callback) { |
61 | utils.getFriendsList(server.url, function (err, res) { | 62 | utils.getFriendsList(server.url, function (err, res) { |
62 | if (err) throw err | 63 | if (err) throw err |
63 | 64 | ||
@@ -72,7 +73,7 @@ describe('Test basic friends', function () { | |||
72 | it('Should make friends', function (done) { | 73 | it('Should make friends', function (done) { |
73 | this.timeout(10000) | 74 | this.timeout(10000) |
74 | 75 | ||
75 | async.series([ | 76 | series([ |
76 | // The second pod make friend with the third | 77 | // The second pod make friend with the third |
77 | function (next) { | 78 | function (next) { |
78 | makeFriends(2, next) | 79 | makeFriends(2, next) |
@@ -119,7 +120,7 @@ describe('Test basic friends', function () { | |||
119 | // Now each pod should be friend with the other ones | 120 | // Now each pod should be friend with the other ones |
120 | function (err) { | 121 | function (err) { |
121 | if (err) throw err | 122 | if (err) throw err |
122 | async.each(servers, function (server, callback) { | 123 | each(servers, function (server, callback) { |
123 | testMadeFriends(servers, server, callback) | 124 | testMadeFriends(servers, server, callback) |
124 | }, done) | 125 | }, done) |
125 | }) | 126 | }) |
@@ -131,7 +132,7 @@ describe('Test basic friends', function () { | |||
131 | }) | 132 | }) |
132 | 133 | ||
133 | it('Should quit friends of pod 2', function (done) { | 134 | it('Should quit friends of pod 2', function (done) { |
134 | async.series([ | 135 | series([ |
135 | // Pod 1 quit friends | 136 | // Pod 1 quit friends |
136 | function (next) { | 137 | function (next) { |
137 | const server = servers[1] | 138 | const server = servers[1] |
@@ -151,7 +152,7 @@ describe('Test basic friends', function () { | |||
151 | }, | 152 | }, |
152 | // Other pods shouldn't have pod 1 too | 153 | // Other pods shouldn't have pod 1 too |
153 | function (next) { | 154 | function (next) { |
154 | async.each([ servers[0].url, servers[2].url ], function (url, callback) { | 155 | each([ servers[0].url, servers[2].url ], function (url, callback) { |
155 | utils.getFriendsList(url, function (err, res) { | 156 | utils.getFriendsList(url, function (err, res) { |
156 | if (err) throw err | 157 | if (err) throw err |
157 | 158 | ||
@@ -169,7 +170,7 @@ describe('Test basic friends', function () { | |||
169 | it('Should allow pod 2 to make friend again', function (done) { | 170 | it('Should allow pod 2 to make friend again', function (done) { |
170 | const server = servers[1] | 171 | const server = servers[1] |
171 | utils.makeFriends(server.url, server.accessToken, function () { | 172 | utils.makeFriends(server.url, server.accessToken, function () { |
172 | async.each(servers, function (server, callback) { | 173 | each(servers, function (server, callback) { |
173 | testMadeFriends(servers, server, callback) | 174 | testMadeFriends(servers, server, callback) |
174 | }, done) | 175 | }, done) |
175 | }) | 176 | }) |