aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/api/friendsBasic.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/api/friendsBasic.js')
-rw-r--r--test/api/friendsBasic.js25
1 files changed, 7 insertions, 18 deletions
diff --git a/test/api/friendsBasic.js b/test/api/friendsBasic.js
index 40ed34199..43ec41633 100644
--- a/test/api/friendsBasic.js
+++ b/test/api/friendsBasic.js
@@ -1,23 +1,12 @@
1;(function () { 1;(function () {
2 'use strict' 2 'use strict'
3 3
4 var request = require('supertest') 4 var async = require('async')
5 var chai = require('chai') 5 var chai = require('chai')
6 var expect = chai.expect 6 var expect = chai.expect
7 var async = require('async') 7 var request = require('supertest')
8
9 var utils = require('../utils')
10
11 function getFriendsList (url, end) {
12 var path = '/api/v1/pods/'
13 8
14 request(url) 9 var utils = require('./utils')
15 .get(path)
16 .set('Accept', 'application/json')
17 .expect(200)
18 .expect('Content-Type', /json/)
19 .end(end)
20 }
21 10
22 describe('Test basic friends', function () { 11 describe('Test basic friends', function () {
23 var apps = [] 12 var apps = []
@@ -34,7 +23,7 @@
34 23
35 it('Should not have friends', function (done) { 24 it('Should not have friends', function (done) {
36 async.each(urls, function (url, callback) { 25 async.each(urls, function (url, callback) {
37 getFriendsList(url, function (err, res) { 26 utils.getFriendsList(url, function (err, res) {
38 if (err) throw err 27 if (err) throw err
39 28
40 var result = res.body 29 var result = res.body
@@ -59,7 +48,7 @@
59 friends.push(urls[i]) 48 friends.push(urls[i])
60 } 49 }
61 50
62 getFriendsList(url_to_test, function (err, res) { 51 utils.getFriendsList(url_to_test, function (err, res) {
63 if (err) throw err 52 if (err) throw err
64 53
65 var result = res.body 54 var result = res.body
@@ -88,7 +77,7 @@
88 // Wait for the request between pods 77 // Wait for the request between pods
89 setTimeout(function () { 78 setTimeout(function () {
90 // The second pod should have the third as a friend 79 // The second pod should have the third as a friend
91 getFriendsList(urls[1], function (err, res) { 80 utils.getFriendsList(urls[1], function (err, res) {
92 if (err) throw err 81 if (err) throw err
93 82
94 var result = res.body 83 var result = res.body
@@ -97,7 +86,7 @@
97 expect(result[0].url).to.be.equal(urls[2]) 86 expect(result[0].url).to.be.equal(urls[2])
98 87
99 // Same here, the third pod should have the second pod as a friend 88 // Same here, the third pod should have the second pod as a friend
100 getFriendsList(urls[2], function (err, res) { 89 utils.getFriendsList(urls[2], function (err, res) {
101 if (err) throw err 90 if (err) throw err
102 91
103 var result = res.body 92 var result = res.body