aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/requests.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/requests.js')
-rw-r--r--server/tests/api/requests.js42
1 files changed, 9 insertions, 33 deletions
diff --git a/server/tests/api/requests.js b/server/tests/api/requests.js
index af36f6e34..933ed29b4 100644
--- a/server/tests/api/requests.js
+++ b/server/tests/api/requests.js
@@ -69,7 +69,7 @@ describe('Test requests stats', function () {
69 }) 69 })
70 }) 70 })
71 71
72 it('Should have the correct request', function (done) { 72 it('Should have the correct total request', function (done) {
73 this.timeout(15000) 73 this.timeout(15000)
74 74
75 const server = servers[0] 75 const server = servers[0]
@@ -79,40 +79,16 @@ describe('Test requests stats', function () {
79 uploadVideo(server, function (err) { 79 uploadVideo(server, function (err) {
80 if (err) throw err 80 if (err) throw err
81 81
82 getRequestsStats(server, function (err, res) { 82 setTimeout(function () {
83 if (err) throw err 83 getRequestsStats(server, function (err, res) {
84 84 if (err) throw err
85 const body = res.body
86 expect(body.requests).to.have.lengthOf(1)
87 85
88 const request = body.requests[0] 86 const body = res.body
89 expect(request.to).to.have.lengthOf(1) 87 expect(body.totalRequests).to.equal(1)
90 expect(request.request.type).to.equal('add')
91 88
92 // Wait one cycle 89 done()
93 setTimeout(done, 10000) 90 })
94 }) 91 }, 1000)
95 })
96 })
97
98 it('Should have the correct requests', function (done) {
99 const server = servers[0]
100
101 uploadVideo(server, function (err) {
102 if (err) throw err
103
104 getRequestsStats(server, function (err, res) {
105 if (err) throw err
106
107 const body = res.body
108 expect(body.requests).to.have.lengthOf(2)
109
110 const request = body.requests[1]
111 expect(request.to).to.have.lengthOf(1)
112 expect(request.request.type).to.equal('add')
113
114 done()
115 })
116 }) 92 })
117 }) 93 })
118 94