diff options
Diffstat (limited to 'server/tests/api/search/search-videos.ts')
-rw-r--r-- | server/tests/api/search/search-videos.ts | 211 |
1 files changed, 118 insertions, 93 deletions
diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts index 5b8907961..f0482c7e0 100644 --- a/server/tests/api/search/search-videos.ts +++ b/server/tests/api/search/search-videos.ts | |||
@@ -4,12 +4,11 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { VideoPrivacy } from '@shared/models' | 5 | import { VideoPrivacy } from '@shared/models' |
6 | import { | 6 | import { |
7 | advancedVideosSearch, | ||
8 | cleanupTests, | 7 | cleanupTests, |
9 | createLive, | 8 | createLive, |
10 | flushAndRunServer, | 9 | flushAndRunServer, |
11 | immutableAssign, | 10 | immutableAssign, |
12 | searchVideo, | 11 | SearchCommand, |
13 | sendRTMPStreamInVideo, | 12 | sendRTMPStreamInVideo, |
14 | ServerInfo, | 13 | ServerInfo, |
15 | setAccessTokensToServers, | 14 | setAccessTokensToServers, |
@@ -29,6 +28,8 @@ describe('Test videos search', function () { | |||
29 | let startDate: string | 28 | let startDate: string |
30 | let videoUUID: string | 29 | let videoUUID: string |
31 | 30 | ||
31 | let command: SearchCommand | ||
32 | |||
32 | before(async function () { | 33 | before(async function () { |
33 | this.timeout(60000) | 34 | this.timeout(60000) |
34 | 35 | ||
@@ -144,21 +145,23 @@ describe('Test videos search', function () { | |||
144 | await uploadVideo(server.url, server.accessToken, attributes1) | 145 | await uploadVideo(server.url, server.accessToken, attributes1) |
145 | await uploadVideo(server.url, server.accessToken, immutableAssign(attributes1, { category: 2 })) | 146 | await uploadVideo(server.url, server.accessToken, immutableAssign(attributes1, { category: 2 })) |
146 | } | 147 | } |
148 | |||
149 | command = server.searchCommand | ||
147 | }) | 150 | }) |
148 | 151 | ||
149 | it('Should make a simple search and not have results', async function () { | 152 | it('Should make a simple search and not have results', async function () { |
150 | const res = await searchVideo(server.url, 'abc') | 153 | const body = await command.searchVideos({ search: 'abc' }) |
151 | 154 | ||
152 | expect(res.body.total).to.equal(0) | 155 | expect(body.total).to.equal(0) |
153 | expect(res.body.data).to.have.lengthOf(0) | 156 | expect(body.data).to.have.lengthOf(0) |
154 | }) | 157 | }) |
155 | 158 | ||
156 | it('Should make a simple search and have results', async function () { | 159 | it('Should make a simple search and have results', async function () { |
157 | const res = await searchVideo(server.url, '4444 5555 duplicate') | 160 | const body = await command.searchVideos({ search: '4444 5555 duplicate' }) |
158 | 161 | ||
159 | expect(res.body.total).to.equal(2) | 162 | expect(body.total).to.equal(2) |
160 | 163 | ||
161 | const videos = res.body.data | 164 | const videos = body.data |
162 | expect(videos).to.have.lengthOf(2) | 165 | expect(videos).to.have.lengthOf(2) |
163 | 166 | ||
164 | // bestmatch | 167 | // bestmatch |
@@ -167,15 +170,15 @@ describe('Test videos search', function () { | |||
167 | }) | 170 | }) |
168 | 171 | ||
169 | it('Should make a search on tags too, and have results', async function () { | 172 | it('Should make a search on tags too, and have results', async function () { |
170 | const query = { | 173 | const search = { |
171 | search: 'aaaa', | 174 | search: 'aaaa', |
172 | categoryOneOf: [ 1 ] | 175 | categoryOneOf: [ 1 ] |
173 | } | 176 | } |
174 | const res = await advancedVideosSearch(server.url, query) | 177 | const body = await command.advancedVideoSearch({ search }) |
175 | 178 | ||
176 | expect(res.body.total).to.equal(2) | 179 | expect(body.total).to.equal(2) |
177 | 180 | ||
178 | const videos = res.body.data | 181 | const videos = body.data |
179 | expect(videos).to.have.lengthOf(2) | 182 | expect(videos).to.have.lengthOf(2) |
180 | 183 | ||
181 | // bestmatch | 184 | // bestmatch |
@@ -184,14 +187,14 @@ describe('Test videos search', function () { | |||
184 | }) | 187 | }) |
185 | 188 | ||
186 | it('Should filter on tags without a search', async function () { | 189 | it('Should filter on tags without a search', async function () { |
187 | const query = { | 190 | const search = { |
188 | tagsAllOf: [ 'bbbb' ] | 191 | tagsAllOf: [ 'bbbb' ] |
189 | } | 192 | } |
190 | const res = await advancedVideosSearch(server.url, query) | 193 | const body = await command.advancedVideoSearch({ search }) |
191 | 194 | ||
192 | expect(res.body.total).to.equal(2) | 195 | expect(body.total).to.equal(2) |
193 | 196 | ||
194 | const videos = res.body.data | 197 | const videos = body.data |
195 | expect(videos).to.have.lengthOf(2) | 198 | expect(videos).to.have.lengthOf(2) |
196 | 199 | ||
197 | expect(videos[0].name).to.equal('9999') | 200 | expect(videos[0].name).to.equal('9999') |
@@ -199,14 +202,14 @@ describe('Test videos search', function () { | |||
199 | }) | 202 | }) |
200 | 203 | ||
201 | it('Should filter on category without a search', async function () { | 204 | it('Should filter on category without a search', async function () { |
202 | const query = { | 205 | const search = { |
203 | categoryOneOf: [ 3 ] | 206 | categoryOneOf: [ 3 ] |
204 | } | 207 | } |
205 | const res = await advancedVideosSearch(server.url, query) | 208 | const body = await command.advancedVideoSearch({ search: search }) |
206 | 209 | ||
207 | expect(res.body.total).to.equal(1) | 210 | expect(body.total).to.equal(1) |
208 | 211 | ||
209 | const videos = res.body.data | 212 | const videos = body.data |
210 | expect(videos).to.have.lengthOf(1) | 213 | expect(videos).to.have.lengthOf(1) |
211 | 214 | ||
212 | expect(videos[0].name).to.equal('6666 7777 8888') | 215 | expect(videos[0].name).to.equal('6666 7777 8888') |
@@ -218,11 +221,16 @@ describe('Test videos search', function () { | |||
218 | categoryOneOf: [ 1 ], | 221 | categoryOneOf: [ 1 ], |
219 | tagsOneOf: [ 'aAaa', 'ffff' ] | 222 | tagsOneOf: [ 'aAaa', 'ffff' ] |
220 | } | 223 | } |
221 | const res1 = await advancedVideosSearch(server.url, query) | ||
222 | expect(res1.body.total).to.equal(2) | ||
223 | 224 | ||
224 | const res2 = await advancedVideosSearch(server.url, immutableAssign(query, { tagsOneOf: [ 'blabla' ] })) | 225 | { |
225 | expect(res2.body.total).to.equal(0) | 226 | const body = await command.advancedVideoSearch({ search: query }) |
227 | expect(body.total).to.equal(2) | ||
228 | } | ||
229 | |||
230 | { | ||
231 | const body = await command.advancedVideoSearch({ search: { ...query, tagsOneOf: [ 'blabla' ] } }) | ||
232 | expect(body.total).to.equal(0) | ||
233 | } | ||
226 | }) | 234 | }) |
227 | 235 | ||
228 | it('Should search by tags (all of)', async function () { | 236 | it('Should search by tags (all of)', async function () { |
@@ -231,14 +239,21 @@ describe('Test videos search', function () { | |||
231 | categoryOneOf: [ 1 ], | 239 | categoryOneOf: [ 1 ], |
232 | tagsAllOf: [ 'CCcc' ] | 240 | tagsAllOf: [ 'CCcc' ] |
233 | } | 241 | } |
234 | const res1 = await advancedVideosSearch(server.url, query) | ||
235 | expect(res1.body.total).to.equal(2) | ||
236 | 242 | ||
237 | const res2 = await advancedVideosSearch(server.url, immutableAssign(query, { tagsAllOf: [ 'blAbla' ] })) | 243 | { |
238 | expect(res2.body.total).to.equal(0) | 244 | const body = await command.advancedVideoSearch({ search: query }) |
245 | expect(body.total).to.equal(2) | ||
246 | } | ||
239 | 247 | ||
240 | const res3 = await advancedVideosSearch(server.url, immutableAssign(query, { tagsAllOf: [ 'bbbb', 'CCCC' ] })) | 248 | { |
241 | expect(res3.body.total).to.equal(1) | 249 | const body = await command.advancedVideoSearch({ search: { ...query, tagsAllOf: [ 'blAbla' ] } }) |
250 | expect(body.total).to.equal(0) | ||
251 | } | ||
252 | |||
253 | { | ||
254 | const body = await command.advancedVideoSearch({ search: { ...query, tagsAllOf: [ 'bbbb', 'CCCC' ] } }) | ||
255 | expect(body.total).to.equal(1) | ||
256 | } | ||
242 | }) | 257 | }) |
243 | 258 | ||
244 | it('Should search by category', async function () { | 259 | it('Should search by category', async function () { |
@@ -246,12 +261,17 @@ describe('Test videos search', function () { | |||
246 | search: '6666', | 261 | search: '6666', |
247 | categoryOneOf: [ 3 ] | 262 | categoryOneOf: [ 3 ] |
248 | } | 263 | } |
249 | const res1 = await advancedVideosSearch(server.url, query) | ||
250 | expect(res1.body.total).to.equal(1) | ||
251 | expect(res1.body.data[0].name).to.equal('6666 7777 8888') | ||
252 | 264 | ||
253 | const res2 = await advancedVideosSearch(server.url, immutableAssign(query, { categoryOneOf: [ 2 ] })) | 265 | { |
254 | expect(res2.body.total).to.equal(0) | 266 | const body = await command.advancedVideoSearch({ search: query }) |
267 | expect(body.total).to.equal(1) | ||
268 | expect(body.data[0].name).to.equal('6666 7777 8888') | ||
269 | } | ||
270 | |||
271 | { | ||
272 | const body = await command.advancedVideoSearch({ search: { ...query, categoryOneOf: [ 2 ] } }) | ||
273 | expect(body.total).to.equal(0) | ||
274 | } | ||
255 | }) | 275 | }) |
256 | 276 | ||
257 | it('Should search by licence', async function () { | 277 | it('Should search by licence', async function () { |
@@ -259,13 +279,18 @@ describe('Test videos search', function () { | |||
259 | search: '4444 5555', | 279 | search: '4444 5555', |
260 | licenceOneOf: [ 2 ] | 280 | licenceOneOf: [ 2 ] |
261 | } | 281 | } |
262 | const res1 = await advancedVideosSearch(server.url, query) | ||
263 | expect(res1.body.total).to.equal(2) | ||
264 | expect(res1.body.data[0].name).to.equal('3333 4444 5555') | ||
265 | expect(res1.body.data[1].name).to.equal('3333 4444 5555 duplicate') | ||
266 | 282 | ||
267 | const res2 = await advancedVideosSearch(server.url, immutableAssign(query, { licenceOneOf: [ 3 ] })) | 283 | { |
268 | expect(res2.body.total).to.equal(0) | 284 | const body = await command.advancedVideoSearch({ search: query }) |
285 | expect(body.total).to.equal(2) | ||
286 | expect(body.data[0].name).to.equal('3333 4444 5555') | ||
287 | expect(body.data[1].name).to.equal('3333 4444 5555 duplicate') | ||
288 | } | ||
289 | |||
290 | { | ||
291 | const body = await command.advancedVideoSearch({ search: { ...query, licenceOneOf: [ 3 ] } }) | ||
292 | expect(body.total).to.equal(0) | ||
293 | } | ||
269 | }) | 294 | }) |
270 | 295 | ||
271 | it('Should search by languages', async function () { | 296 | it('Should search by languages', async function () { |
@@ -275,23 +300,23 @@ describe('Test videos search', function () { | |||
275 | } | 300 | } |
276 | 301 | ||
277 | { | 302 | { |
278 | const res = await advancedVideosSearch(server.url, query) | 303 | const body = await command.advancedVideoSearch({ search: query }) |
279 | expect(res.body.total).to.equal(2) | 304 | expect(body.total).to.equal(2) |
280 | expect(res.body.data[0].name).to.equal('1111 2222 3333 - 3') | 305 | expect(body.data[0].name).to.equal('1111 2222 3333 - 3') |
281 | expect(res.body.data[1].name).to.equal('1111 2222 3333 - 4') | 306 | expect(body.data[1].name).to.equal('1111 2222 3333 - 4') |
282 | } | 307 | } |
283 | 308 | ||
284 | { | 309 | { |
285 | const res = await advancedVideosSearch(server.url, immutableAssign(query, { languageOneOf: [ 'pl', 'en', '_unknown' ] })) | 310 | const body = await command.advancedVideoSearch({ search: { ...query, languageOneOf: [ 'pl', 'en', '_unknown' ] } }) |
286 | expect(res.body.total).to.equal(3) | 311 | expect(body.total).to.equal(3) |
287 | expect(res.body.data[0].name).to.equal('1111 2222 3333 - 3') | 312 | expect(body.data[0].name).to.equal('1111 2222 3333 - 3') |
288 | expect(res.body.data[1].name).to.equal('1111 2222 3333 - 4') | 313 | expect(body.data[1].name).to.equal('1111 2222 3333 - 4') |
289 | expect(res.body.data[2].name).to.equal('1111 2222 3333 - 5') | 314 | expect(body.data[2].name).to.equal('1111 2222 3333 - 5') |
290 | } | 315 | } |
291 | 316 | ||
292 | { | 317 | { |
293 | const res = await advancedVideosSearch(server.url, immutableAssign(query, { languageOneOf: [ 'eo' ] })) | 318 | const body = await command.advancedVideoSearch({ search: { ...query, languageOneOf: [ 'eo' ] } }) |
294 | expect(res.body.total).to.equal(0) | 319 | expect(body.total).to.equal(0) |
295 | } | 320 | } |
296 | }) | 321 | }) |
297 | 322 | ||
@@ -301,10 +326,10 @@ describe('Test videos search', function () { | |||
301 | startDate | 326 | startDate |
302 | } | 327 | } |
303 | 328 | ||
304 | const res = await advancedVideosSearch(server.url, query) | 329 | const body = await command.advancedVideoSearch({ search: query }) |
305 | expect(res.body.total).to.equal(4) | 330 | expect(body.total).to.equal(4) |
306 | 331 | ||
307 | const videos = res.body.data | 332 | const videos = body.data |
308 | expect(videos[0].name).to.equal('1111 2222 3333 - 5') | 333 | expect(videos[0].name).to.equal('1111 2222 3333 - 5') |
309 | expect(videos[1].name).to.equal('1111 2222 3333 - 6') | 334 | expect(videos[1].name).to.equal('1111 2222 3333 - 6') |
310 | expect(videos[2].name).to.equal('1111 2222 3333 - 7') | 335 | expect(videos[2].name).to.equal('1111 2222 3333 - 7') |
@@ -320,10 +345,10 @@ describe('Test videos search', function () { | |||
320 | licenceOneOf: [ 1, 4 ] | 345 | licenceOneOf: [ 1, 4 ] |
321 | } | 346 | } |
322 | 347 | ||
323 | const res = await advancedVideosSearch(server.url, query) | 348 | const body = await command.advancedVideoSearch({ search: query }) |
324 | expect(res.body.total).to.equal(4) | 349 | expect(body.total).to.equal(4) |
325 | 350 | ||
326 | const videos = res.body.data | 351 | const videos = body.data |
327 | expect(videos[0].name).to.equal('1111 2222 3333') | 352 | expect(videos[0].name).to.equal('1111 2222 3333') |
328 | expect(videos[1].name).to.equal('1111 2222 3333 - 6') | 353 | expect(videos[1].name).to.equal('1111 2222 3333 - 6') |
329 | expect(videos[2].name).to.equal('1111 2222 3333 - 7') | 354 | expect(videos[2].name).to.equal('1111 2222 3333 - 7') |
@@ -340,10 +365,10 @@ describe('Test videos search', function () { | |||
340 | sort: '-name' | 365 | sort: '-name' |
341 | } | 366 | } |
342 | 367 | ||
343 | const res = await advancedVideosSearch(server.url, query) | 368 | const body = await command.advancedVideoSearch({ search: query }) |
344 | expect(res.body.total).to.equal(4) | 369 | expect(body.total).to.equal(4) |
345 | 370 | ||
346 | const videos = res.body.data | 371 | const videos = body.data |
347 | expect(videos[0].name).to.equal('1111 2222 3333 - 8') | 372 | expect(videos[0].name).to.equal('1111 2222 3333 - 8') |
348 | expect(videos[1].name).to.equal('1111 2222 3333 - 7') | 373 | expect(videos[1].name).to.equal('1111 2222 3333 - 7') |
349 | expect(videos[2].name).to.equal('1111 2222 3333 - 6') | 374 | expect(videos[2].name).to.equal('1111 2222 3333 - 6') |
@@ -362,10 +387,10 @@ describe('Test videos search', function () { | |||
362 | count: 1 | 387 | count: 1 |
363 | } | 388 | } |
364 | 389 | ||
365 | const res = await advancedVideosSearch(server.url, query) | 390 | const body = await command.advancedVideoSearch({ search: query }) |
366 | expect(res.body.total).to.equal(4) | 391 | expect(body.total).to.equal(4) |
367 | 392 | ||
368 | const videos = res.body.data | 393 | const videos = body.data |
369 | expect(videos[0].name).to.equal('1111 2222 3333 - 8') | 394 | expect(videos[0].name).to.equal('1111 2222 3333 - 8') |
370 | }) | 395 | }) |
371 | 396 | ||
@@ -381,10 +406,10 @@ describe('Test videos search', function () { | |||
381 | count: 1 | 406 | count: 1 |
382 | } | 407 | } |
383 | 408 | ||
384 | const res = await advancedVideosSearch(server.url, query) | 409 | const body = await command.advancedVideoSearch({ search: query }) |
385 | expect(res.body.total).to.equal(4) | 410 | expect(body.total).to.equal(4) |
386 | 411 | ||
387 | const videos = res.body.data | 412 | const videos = body.data |
388 | expect(videos[0].name).to.equal('1111 2222 3333') | 413 | expect(videos[0].name).to.equal('1111 2222 3333') |
389 | }) | 414 | }) |
390 | 415 | ||
@@ -399,32 +424,32 @@ describe('Test videos search', function () { | |||
399 | 424 | ||
400 | { | 425 | { |
401 | const query = immutableAssign(baseQuery, { originallyPublishedStartDate: '2019-02-11T09:58:08.286Z' }) | 426 | const query = immutableAssign(baseQuery, { originallyPublishedStartDate: '2019-02-11T09:58:08.286Z' }) |
402 | const res = await advancedVideosSearch(server.url, query) | 427 | const body = await command.advancedVideoSearch({ search: query }) |
403 | 428 | ||
404 | expect(res.body.total).to.equal(1) | 429 | expect(body.total).to.equal(1) |
405 | expect(res.body.data[0].name).to.equal('1111 2222 3333 - 7') | 430 | expect(body.data[0].name).to.equal('1111 2222 3333 - 7') |
406 | } | 431 | } |
407 | 432 | ||
408 | { | 433 | { |
409 | const query = immutableAssign(baseQuery, { originallyPublishedEndDate: '2019-03-11T09:58:08.286Z' }) | 434 | const query = immutableAssign(baseQuery, { originallyPublishedEndDate: '2019-03-11T09:58:08.286Z' }) |
410 | const res = await advancedVideosSearch(server.url, query) | 435 | const body = await command.advancedVideoSearch({ search: query }) |
411 | 436 | ||
412 | expect(res.body.total).to.equal(1) | 437 | expect(body.total).to.equal(1) |
413 | expect(res.body.data[0].name).to.equal('1111 2222 3333 - 7') | 438 | expect(body.data[0].name).to.equal('1111 2222 3333 - 7') |
414 | } | 439 | } |
415 | 440 | ||
416 | { | 441 | { |
417 | const query = immutableAssign(baseQuery, { originallyPublishedEndDate: '2019-01-11T09:58:08.286Z' }) | 442 | const query = immutableAssign(baseQuery, { originallyPublishedEndDate: '2019-01-11T09:58:08.286Z' }) |
418 | const res = await advancedVideosSearch(server.url, query) | 443 | const body = await command.advancedVideoSearch({ search: query }) |
419 | 444 | ||
420 | expect(res.body.total).to.equal(0) | 445 | expect(body.total).to.equal(0) |
421 | } | 446 | } |
422 | 447 | ||
423 | { | 448 | { |
424 | const query = immutableAssign(baseQuery, { originallyPublishedStartDate: '2019-03-11T09:58:08.286Z' }) | 449 | const query = immutableAssign(baseQuery, { originallyPublishedStartDate: '2019-03-11T09:58:08.286Z' }) |
425 | const res = await advancedVideosSearch(server.url, query) | 450 | const body = await command.advancedVideoSearch({ search: query }) |
426 | 451 | ||
427 | expect(res.body.total).to.equal(0) | 452 | expect(body.total).to.equal(0) |
428 | } | 453 | } |
429 | 454 | ||
430 | { | 455 | { |
@@ -432,9 +457,9 @@ describe('Test videos search', function () { | |||
432 | originallyPublishedStartDate: '2019-01-11T09:58:08.286Z', | 457 | originallyPublishedStartDate: '2019-01-11T09:58:08.286Z', |
433 | originallyPublishedEndDate: '2019-01-10T09:58:08.286Z' | 458 | originallyPublishedEndDate: '2019-01-10T09:58:08.286Z' |
434 | }) | 459 | }) |
435 | const res = await advancedVideosSearch(server.url, query) | 460 | const body = await command.advancedVideoSearch({ search: query }) |
436 | 461 | ||
437 | expect(res.body.total).to.equal(0) | 462 | expect(body.total).to.equal(0) |
438 | } | 463 | } |
439 | 464 | ||
440 | { | 465 | { |
@@ -442,19 +467,19 @@ describe('Test videos search', function () { | |||
442 | originallyPublishedStartDate: '2019-01-11T09:58:08.286Z', | 467 | originallyPublishedStartDate: '2019-01-11T09:58:08.286Z', |
443 | originallyPublishedEndDate: '2019-04-11T09:58:08.286Z' | 468 | originallyPublishedEndDate: '2019-04-11T09:58:08.286Z' |
444 | }) | 469 | }) |
445 | const res = await advancedVideosSearch(server.url, query) | 470 | const body = await command.advancedVideoSearch({ search: query }) |
446 | 471 | ||
447 | expect(res.body.total).to.equal(1) | 472 | expect(body.total).to.equal(1) |
448 | expect(res.body.data[0].name).to.equal('1111 2222 3333 - 7') | 473 | expect(body.data[0].name).to.equal('1111 2222 3333 - 7') |
449 | } | 474 | } |
450 | }) | 475 | }) |
451 | 476 | ||
452 | it('Should search by UUID', async function () { | 477 | it('Should search by UUID', async function () { |
453 | const search = videoUUID | 478 | const search = videoUUID |
454 | const res = await advancedVideosSearch(server.url, { search }) | 479 | const body = await command.advancedVideoSearch({ search: { search } }) |
455 | 480 | ||
456 | expect(res.body.total).to.equal(1) | 481 | expect(body.total).to.equal(1) |
457 | expect(res.body.data[0].name).to.equal('1111 2222 3333 - 3') | 482 | expect(body.data[0].name).to.equal('1111 2222 3333 - 3') |
458 | }) | 483 | }) |
459 | 484 | ||
460 | it('Should search by live', async function () { | 485 | it('Should search by live', async function () { |
@@ -471,10 +496,10 @@ describe('Test videos search', function () { | |||
471 | } | 496 | } |
472 | 497 | ||
473 | { | 498 | { |
474 | const res = await advancedVideosSearch(server.url, { isLive: true }) | 499 | const body = await command.advancedVideoSearch({ search: { isLive: true } }) |
475 | 500 | ||
476 | expect(res.body.total).to.equal(0) | 501 | expect(body.total).to.equal(0) |
477 | expect(res.body.data).to.have.lengthOf(0) | 502 | expect(body.data).to.have.lengthOf(0) |
478 | } | 503 | } |
479 | 504 | ||
480 | { | 505 | { |
@@ -482,15 +507,15 @@ describe('Test videos search', function () { | |||
482 | const resLive = await createLive(server.url, server.accessToken, liveOptions) | 507 | const resLive = await createLive(server.url, server.accessToken, liveOptions) |
483 | const liveVideoId = resLive.body.video.uuid | 508 | const liveVideoId = resLive.body.video.uuid |
484 | 509 | ||
485 | const command = await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId) | 510 | const ffmpegCommand = await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId) |
486 | await waitUntilLivePublished(server.url, server.accessToken, liveVideoId) | 511 | await waitUntilLivePublished(server.url, server.accessToken, liveVideoId) |
487 | 512 | ||
488 | const res = await advancedVideosSearch(server.url, { isLive: true }) | 513 | const body = await command.advancedVideoSearch({ search: { isLive: true } }) |
489 | 514 | ||
490 | expect(res.body.total).to.equal(1) | 515 | expect(body.total).to.equal(1) |
491 | expect(res.body.data[0].name).to.equal('live') | 516 | expect(body.data[0].name).to.equal('live') |
492 | 517 | ||
493 | await stopFfmpeg(command) | 518 | await stopFfmpeg(ffmpegCommand) |
494 | } | 519 | } |
495 | }) | 520 | }) |
496 | 521 | ||