From 876d1bcfd07b14d47ba377474e3bb680872d1f7a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sun, 6 Dec 2015 17:09:07 +0100 Subject: Tests refractoring --- test/api/friendsBasic.js | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'test/api/friendsBasic.js') 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 @@ ;(function () { 'use strict' - var request = require('supertest') + var async = require('async') var chai = require('chai') var expect = chai.expect - var async = require('async') - - var utils = require('../utils') - - function getFriendsList (url, end) { - var path = '/api/v1/pods/' + var request = require('supertest') - request(url) - .get(path) - .set('Accept', 'application/json') - .expect(200) - .expect('Content-Type', /json/) - .end(end) - } + var utils = require('./utils') describe('Test basic friends', function () { var apps = [] @@ -34,7 +23,7 @@ it('Should not have friends', function (done) { async.each(urls, function (url, callback) { - getFriendsList(url, function (err, res) { + utils.getFriendsList(url, function (err, res) { if (err) throw err var result = res.body @@ -59,7 +48,7 @@ friends.push(urls[i]) } - getFriendsList(url_to_test, function (err, res) { + utils.getFriendsList(url_to_test, function (err, res) { if (err) throw err var result = res.body @@ -88,7 +77,7 @@ // Wait for the request between pods setTimeout(function () { // The second pod should have the third as a friend - getFriendsList(urls[1], function (err, res) { + utils.getFriendsList(urls[1], function (err, res) { if (err) throw err var result = res.body @@ -97,7 +86,7 @@ expect(result[0].url).to.be.equal(urls[2]) // Same here, the third pod should have the second pod as a friend - getFriendsList(urls[2], function (err, res) { + utils.getFriendsList(urls[2], function (err, res) { if (err) throw err var result = res.body -- cgit v1.2.3