From ee66c5930e6c3694434a259dfb4b7f3e9f39cf7b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sun, 24 Jan 2016 16:08:09 +0100 Subject: Tests refractoring --- test/api/checkParams.js | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) (limited to 'test/api/checkParams.js') diff --git a/test/api/checkParams.js b/test/api/checkParams.js index 0fa83655f..11fc68ff9 100644 --- a/test/api/checkParams.js +++ b/test/api/checkParams.js @@ -1,6 +1,7 @@ ;(function () { 'use strict' + var async = require('async') var chai = require('chai') var expect = chai.expect var request = require('supertest') @@ -11,18 +12,6 @@ var app = null var url = '' - before(function (done) { - this.timeout(20000) - - utils.flushTests(function () { - utils.runServer(1, function (app1, url1) { - app = app1 - url = url1 - done() - }) - }) - }) - function makePostRequest (path, fields, attach, done, fail) { var status_code = 400 if (fail !== undefined && fail === false) status_code = 200 @@ -50,6 +39,25 @@ .expect(status_code, done) } + // --------------------------------------------------------------- + + before(function (done) { + this.timeout(20000) + + async.series([ + function (next) { + utils.flushTests(next) + }, + function (next) { + utils.runServer(1, function (app1, url1) { + app = app1 + url = url1 + next() + }) + } + ], done) + }) + describe('Of the pods API', function () { var path = '/api/v1/pods/' @@ -284,9 +292,7 @@ // Keep the logs if the test failed if (this.ok) { - utils.flushTests(function () { - done() - }) + utils.flushTests(done) } else { done() } -- cgit v1.2.3