aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/multiplePods.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-05-03 21:03:51 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-05-03 21:03:51 +0200
commit6d8ada5f24b245d3c84d29d65013f5315cbeff27 (patch)
tree2b4fdb38353279927c013219c03cbbe109086931 /server/tests/api/multiplePods.js
parent17c912d9b111eb4af3ff171a23dc866f76dc4fab (diff)
downloadPeerTube-6d8ada5f24b245d3c84d29d65013f5315cbeff27.tar.gz
PeerTube-6d8ada5f24b245d3c84d29d65013f5315cbeff27.tar.zst
PeerTube-6d8ada5f24b245d3c84d29d65013f5315cbeff27.zip
Better tests for a better world
Diffstat (limited to 'server/tests/api/multiplePods.js')
-rw-r--r--server/tests/api/multiplePods.js46
1 files changed, 33 insertions, 13 deletions
diff --git a/server/tests/api/multiplePods.js b/server/tests/api/multiplePods.js
index b6545ca60..ba4ce70c9 100644
--- a/server/tests/api/multiplePods.js
+++ b/server/tests/api/multiplePods.js
@@ -96,6 +96,12 @@ describe('Test multiple pods', function () {
96 expect(video.podUrl).to.equal('http://localhost:9001') 96 expect(video.podUrl).to.equal('http://localhost:9001')
97 expect(video.magnetUri).to.exist 97 expect(video.magnetUri).to.exist
98 98
99 if (server.url !== 'http://localhost:9001') {
100 expect(video.isLocal).to.be.false
101 } else {
102 expect(video.isLocal).to.be.true
103 }
104
99 // All pods should have the same magnet Uri 105 // All pods should have the same magnet Uri
100 if (base_magnet === null) { 106 if (base_magnet === null) {
101 base_magnet = video.magnetUri 107 base_magnet = video.magnetUri
@@ -139,6 +145,12 @@ describe('Test multiple pods', function () {
139 expect(video.podUrl).to.equal('http://localhost:9002') 145 expect(video.podUrl).to.equal('http://localhost:9002')
140 expect(video.magnetUri).to.exist 146 expect(video.magnetUri).to.exist
141 147
148 if (server.url !== 'http://localhost:9002') {
149 expect(video.isLocal).to.be.false
150 } else {
151 expect(video.isLocal).to.be.true
152 }
153
142 // All pods should have the same magnet Uri 154 // All pods should have the same magnet Uri
143 if (base_magnet === null) { 155 if (base_magnet === null) {
144 base_magnet = video.magnetUri 156 base_magnet = video.magnetUri
@@ -178,23 +190,31 @@ describe('Test multiple pods', function () {
178 const videos = res.body 190 const videos = res.body
179 expect(videos).to.be.an('array') 191 expect(videos).to.be.an('array')
180 expect(videos.length).to.equal(4) 192 expect(videos.length).to.equal(4)
181 let video = videos[2] 193 const video1 = videos[2]
182 expect(video.name).to.equal('my super name for pod 3') 194 expect(video1.name).to.equal('my super name for pod 3')
183 expect(video.description).to.equal('my super description for pod 3') 195 expect(video1.description).to.equal('my super description for pod 3')
184 expect(video.podUrl).to.equal('http://localhost:9003') 196 expect(video1.podUrl).to.equal('http://localhost:9003')
185 expect(video.magnetUri).to.exist 197 expect(video1.magnetUri).to.exist
186 198
187 video = videos[3] 199 const video2 = videos[3]
188 expect(video.name).to.equal('my super name for pod 3-2') 200 expect(video2.name).to.equal('my super name for pod 3-2')
189 expect(video.description).to.equal('my super description for pod 3-2') 201 expect(video2.description).to.equal('my super description for pod 3-2')
190 expect(video.podUrl).to.equal('http://localhost:9003') 202 expect(video2.podUrl).to.equal('http://localhost:9003')
191 expect(video.magnetUri).to.exist 203 expect(video2.magnetUri).to.exist
204
205 if (server.url !== 'http://localhost:9003') {
206 expect(video1.isLocal).to.be.false
207 expect(video2.isLocal).to.be.false
208 } else {
209 expect(video1.isLocal).to.be.true
210 expect(video2.isLocal).to.be.true
211 }
192 212
193 // All pods should have the same magnet Uri 213 // All pods should have the same magnet Uri
194 if (base_magnet === null) { 214 if (base_magnet === null) {
195 base_magnet = video.magnetUri 215 base_magnet = video2.magnetUri
196 } else { 216 } else {
197 expect(video.magnetUri).to.equal.magnetUri 217 expect(video2.magnetUri).to.equal.magnetUri
198 } 218 }
199 219
200 callback() 220 callback()