diff options
Diffstat (limited to 'server/tests/api/friends-basic.js')
-rw-r--r-- | server/tests/api/friends-basic.js | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/server/tests/api/friends-basic.js b/server/tests/api/friends-basic.js index 4c2043b39..5f1fdd255 100644 --- a/server/tests/api/friends-basic.js +++ b/server/tests/api/friends-basic.js | |||
@@ -198,6 +198,71 @@ describe('Test basic friends', function () { | |||
198 | }) | 198 | }) |
199 | }) | 199 | }) |
200 | 200 | ||
201 | it('Should allow pod 1 to quit only pod 2', function (done) { | ||
202 | series([ | ||
203 | // Pod 1 quits pod 2 | ||
204 | function (next) { | ||
205 | const server = servers[0] | ||
206 | |||
207 | // Get pod 2 id so we can query it | ||
208 | podsUtils.getFriendsList(server.url, function (err, res) { | ||
209 | if (err) throw err | ||
210 | |||
211 | const result = res.body.data | ||
212 | let pod = result.find((friend) => (friend.host === servers[1].host)) | ||
213 | |||
214 | // Remove it from the friends list | ||
215 | podsUtils.quitOneFriend(server.url, server.accessToken, pod.id, next) | ||
216 | }) | ||
217 | }, | ||
218 | |||
219 | // Pod 1 should have only pod 3 in its friends list | ||
220 | function (next) { | ||
221 | podsUtils.getFriendsList(servers[0].url, function (err, res) { | ||
222 | if (err) throw err | ||
223 | |||
224 | const result = res.body.data | ||
225 | expect(result).to.be.an('array') | ||
226 | expect(result.length).to.equal(1) | ||
227 | |||
228 | const pod = result[0] | ||
229 | expect(pod.host).to.equal(servers[2].host) | ||
230 | |||
231 | next() | ||
232 | }) | ||
233 | }, | ||
234 | |||
235 | // Pod 2 should have only pod 3 in its friends list | ||
236 | function (next) { | ||
237 | podsUtils.getFriendsList(servers[1].url, function (err, res) { | ||
238 | if (err) throw err | ||
239 | |||
240 | const result = res.body.data | ||
241 | expect(result).to.be.an('array') | ||
242 | expect(result.length).to.equal(1) | ||
243 | |||
244 | const pod = result[0] | ||
245 | expect(pod.host).to.equal(servers[2].host) | ||
246 | |||
247 | next() | ||
248 | }) | ||
249 | }, | ||
250 | |||
251 | // Pod 3 should have both pods in its friends list | ||
252 | function (next) { | ||
253 | podsUtils.getFriendsList(servers[2].url, function (err, res) { | ||
254 | if (err) throw err | ||
255 | |||
256 | const result = res.body.data | ||
257 | expect(result).to.be.an('array') | ||
258 | expect(result.length).to.equal(2) | ||
259 | |||
260 | next() | ||
261 | }) | ||
262 | } | ||
263 | ], done) | ||
264 | }) | ||
265 | |||
201 | after(function (done) { | 266 | after(function (done) { |
202 | servers.forEach(function (server) { | 267 | servers.forEach(function (server) { |
203 | process.kill(-server.app.pid) | 268 | process.kill(-server.app.pid) |