1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 10:49:28 +02:00

Tests refractoring

This commit is contained in:
Chocobozzz 2016-01-24 16:08:09 +01:00
parent 45239549bf
commit ee66c5930e
6 changed files with 414 additions and 340 deletions

View file

@ -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()
}