diff options
Diffstat (limited to 'server/tests/api/search/search-videos.ts')
-rw-r--r-- | server/tests/api/search/search-videos.ts | 66 |
1 files changed, 65 insertions, 1 deletions
diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts index 50da837da..fa4078b99 100644 --- a/server/tests/api/search/search-videos.ts +++ b/server/tests/api/search/search-videos.ts | |||
@@ -60,7 +60,10 @@ describe('Test a videos search', function () { | |||
60 | const attributes6 = immutableAssign(attributes1, { name: attributes1.name + ' - 6', tags: [ 't1', 't2 '] }) | 60 | const attributes6 = immutableAssign(attributes1, { name: attributes1.name + ' - 6', tags: [ 't1', 't2 '] }) |
61 | await uploadVideo(server.url, server.accessToken, attributes6) | 61 | await uploadVideo(server.url, server.accessToken, attributes6) |
62 | 62 | ||
63 | const attributes7 = immutableAssign(attributes1, { name: attributes1.name + ' - 7' }) | 63 | const attributes7 = immutableAssign(attributes1, { |
64 | name: attributes1.name + ' - 7', | ||
65 | originallyPublishedAt: '2019-02-12T09:58:08.286Z' | ||
66 | }) | ||
64 | await uploadVideo(server.url, server.accessToken, attributes7) | 67 | await uploadVideo(server.url, server.accessToken, attributes7) |
65 | 68 | ||
66 | const attributes8 = immutableAssign(attributes1, { name: attributes1.name + ' - 8', licence: 4 }) | 69 | const attributes8 = immutableAssign(attributes1, { name: attributes1.name + ' - 8', licence: 4 }) |
@@ -343,6 +346,67 @@ describe('Test a videos search', function () { | |||
343 | expect(videos[0].name).to.equal('1111 2222 3333') | 346 | expect(videos[0].name).to.equal('1111 2222 3333') |
344 | }) | 347 | }) |
345 | 348 | ||
349 | it('Should search on originally published date', async function () { | ||
350 | const baseQuery = { | ||
351 | search: '1111 2222 3333', | ||
352 | languageOneOf: [ 'pl', 'fr' ], | ||
353 | durationMax: 4, | ||
354 | nsfw: 'false' as 'false', | ||
355 | licenceOneOf: [ 1, 4 ] | ||
356 | } | ||
357 | |||
358 | { | ||
359 | const query = immutableAssign(baseQuery, { originallyPublishedStartDate: '2019-02-11T09:58:08.286Z' }) | ||
360 | const res = await advancedVideosSearch(server.url, query) | ||
361 | |||
362 | expect(res.body.total).to.equal(1) | ||
363 | expect(res.body.data[0].name).to.equal('1111 2222 3333 - 7') | ||
364 | } | ||
365 | |||
366 | { | ||
367 | const query = immutableAssign(baseQuery, { originallyPublishedEndDate: '2019-03-11T09:58:08.286Z' }) | ||
368 | const res = await advancedVideosSearch(server.url, query) | ||
369 | |||
370 | expect(res.body.total).to.equal(1) | ||
371 | expect(res.body.data[0].name).to.equal('1111 2222 3333 - 7') | ||
372 | } | ||
373 | |||
374 | { | ||
375 | const query = immutableAssign(baseQuery, { originallyPublishedEndDate: '2019-01-11T09:58:08.286Z' }) | ||
376 | const res = await advancedVideosSearch(server.url, query) | ||
377 | |||
378 | expect(res.body.total).to.equal(0) | ||
379 | } | ||
380 | |||
381 | { | ||
382 | const query = immutableAssign(baseQuery, { originallyPublishedStartDate: '2019-03-11T09:58:08.286Z' }) | ||
383 | const res = await advancedVideosSearch(server.url, query) | ||
384 | |||
385 | expect(res.body.total).to.equal(0) | ||
386 | } | ||
387 | |||
388 | { | ||
389 | const query = immutableAssign(baseQuery, { | ||
390 | originallyPublishedStartDate: '2019-01-11T09:58:08.286Z', | ||
391 | originallyPublishedEndDate: '2019-01-10T09:58:08.286Z' | ||
392 | }) | ||
393 | const res = await advancedVideosSearch(server.url, query) | ||
394 | |||
395 | expect(res.body.total).to.equal(0) | ||
396 | } | ||
397 | |||
398 | { | ||
399 | const query = immutableAssign(baseQuery, { | ||
400 | originallyPublishedStartDate: '2019-01-11T09:58:08.286Z', | ||
401 | originallyPublishedEndDate: '2019-04-11T09:58:08.286Z' | ||
402 | }) | ||
403 | const res = await advancedVideosSearch(server.url, query) | ||
404 | |||
405 | expect(res.body.total).to.equal(1) | ||
406 | expect(res.body.data[0].name).to.equal('1111 2222 3333 - 7') | ||
407 | } | ||
408 | }) | ||
409 | |||
346 | after(async function () { | 410 | after(async function () { |
347 | killallServers([ server ]) | 411 | killallServers([ server ]) |
348 | 412 | ||