1 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
3 import { expect } from 'chai'
6 PeerTubeProblemDocument,
12 } from '@shared/models'
15 createMultipleServers,
21 setAccessTokensToServers,
22 setDefaultVideoChannel,
24 } from '@shared/server-commands'
25 import { FIXTURE_URLS } from '../shared'
27 describe('Test plugin filter hooks', function () {
28 let servers: PeerTubeServer[]
31 let videoPlaylistUUID: string
33 before(async function () {
36 servers = await createMultipleServers(2)
37 await setAccessTokensToServers(servers)
38 await setDefaultVideoChannel(servers)
39 await doubleFollow(servers[0], servers[1])
41 await servers[0].plugins.install({ path: PluginsCommand.getPluginTestPath() })
42 await servers[0].plugins.install({ path: PluginsCommand.getPluginTestPath('-filter-translations') })
44 ({ uuid: videoPlaylistUUID } = await servers[0].playlists.create({
46 displayName: 'my super playlist',
47 privacy: VideoPlaylistPrivacy.PUBLIC,
48 description: 'my super description',
49 videoChannelId: servers[0].store.channel.id
54 for (let i = 0; i < 10; i++) {
55 const video = await servers[0].videos.upload({ attributes: { name: 'default video ' + i } })
56 await servers[0].playlists.addElement({ playlistId: videoPlaylistUUID, attributes: { videoId: video.id } })
59 const { data } = await servers[0].videos.list()
60 videoUUID = data[0].uuid
62 await servers[0].config.updateCustomSubConfig({
64 live: { enabled: true },
65 signup: { enabled: true },
68 http: { enabled: true },
69 torrent: { enabled: true }
75 // Root subscribes to itself
76 await servers[0].subscriptions.add({ targetUri: 'root_channel@' + servers[0].host })
79 describe('Videos', function () {
81 it('Should run filter:api.videos.list.params', async function () {
82 const { data } = await servers[0].videos.list({ start: 0, count: 2 })
84 // 2 plugins do +1 to the count parameter
85 expect(data).to.have.lengthOf(4)
88 it('Should run filter:api.videos.list.result', async function () {
89 const { total } = await servers[0].videos.list({ start: 0, count: 0 })
91 // Plugin do +1 to the total result
92 expect(total).to.equal(11)
95 it('Should run filter:api.video-playlist.videos.list.params', async function () {
96 const { data } = await servers[0].playlists.listVideos({
98 playlistId: videoPlaylistUUID
101 // 1 plugin do +1 to the count parameter
102 expect(data).to.have.lengthOf(3)
105 it('Should run filter:api.video-playlist.videos.list.result', async function () {
106 const { total } = await servers[0].playlists.listVideos({
108 playlistId: videoPlaylistUUID
111 // Plugin do +1 to the total result
112 expect(total).to.equal(11)
115 it('Should run filter:api.accounts.videos.list.params', async function () {
116 const { data } = await servers[0].videos.listByAccount({ handle: 'root', start: 0, count: 2 })
118 // 1 plugin do +1 to the count parameter
119 expect(data).to.have.lengthOf(3)
122 it('Should run filter:api.accounts.videos.list.result', async function () {
123 const { total } = await servers[0].videos.listByAccount({ handle: 'root', start: 0, count: 2 })
125 // Plugin do +2 to the total result
126 expect(total).to.equal(12)
129 it('Should run filter:api.video-channels.videos.list.params', async function () {
130 const { data } = await servers[0].videos.listByChannel({ handle: 'root_channel', start: 0, count: 2 })
132 // 1 plugin do +3 to the count parameter
133 expect(data).to.have.lengthOf(5)
136 it('Should run filter:api.video-channels.videos.list.result', async function () {
137 const { total } = await servers[0].videos.listByChannel({ handle: 'root_channel', start: 0, count: 2 })
139 // Plugin do +3 to the total result
140 expect(total).to.equal(13)
143 it('Should run filter:api.user.me.videos.list.params', async function () {
144 const { data } = await servers[0].videos.listMyVideos({ start: 0, count: 2 })
146 // 1 plugin do +4 to the count parameter
147 expect(data).to.have.lengthOf(6)
150 it('Should run filter:api.user.me.videos.list.result', async function () {
151 const { total } = await servers[0].videos.listMyVideos({ start: 0, count: 2 })
153 // Plugin do +4 to the total result
154 expect(total).to.equal(14)
157 it('Should run filter:api.user.me.subscription-videos.list.params', async function () {
158 const { data } = await servers[0].videos.listMySubscriptionVideos({ start: 0, count: 2 })
160 // 1 plugin do +1 to the count parameter
161 expect(data).to.have.lengthOf(3)
164 it('Should run filter:api.user.me.subscription-videos.list.result', async function () {
165 const { total } = await servers[0].videos.listMySubscriptionVideos({ start: 0, count: 2 })
167 // Plugin do +4 to the total result
168 expect(total).to.equal(14)
171 it('Should run filter:api.video.get.result', async function () {
172 const video = await servers[0].videos.get({ id: videoUUID })
173 expect(video.name).to.contain('<3')
177 describe('Video/live/import accept', function () {
179 it('Should run filter:api.video.upload.accept.result', async function () {
180 await servers[0].videos.upload({ attributes: { name: 'video with bad word' }, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
183 it('Should run filter:api.live-video.create.accept.result', async function () {
185 name: 'video with bad word',
186 privacy: VideoPrivacy.PUBLIC,
187 channelId: servers[0].store.channel.id
190 await servers[0].live.create({ fields: attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
193 it('Should run filter:api.video.pre-import-url.accept.result', async function () {
195 name: 'normal title',
196 privacy: VideoPrivacy.PUBLIC,
197 channelId: servers[0].store.channel.id,
198 targetUrl: FIXTURE_URLS.goodVideo + 'bad'
200 await servers[0].imports.importVideo({ attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
203 it('Should run filter:api.video.pre-import-torrent.accept.result', async function () {
206 privacy: VideoPrivacy.PUBLIC,
207 channelId: servers[0].store.channel.id,
208 torrentfile: 'video-720p.torrent' as any
210 await servers[0].imports.importVideo({ attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
213 it('Should run filter:api.video.post-import-url.accept.result', async function () {
216 let videoImportId: number
220 name: 'title with bad word',
221 privacy: VideoPrivacy.PUBLIC,
222 channelId: servers[0].store.channel.id,
223 targetUrl: FIXTURE_URLS.goodVideo
225 const body = await servers[0].imports.importVideo({ attributes })
226 videoImportId = body.id
229 await waitJobs(servers)
232 const body = await servers[0].imports.getMyVideoImports()
233 const videoImports = body.data
235 const videoImport = videoImports.find(i => i.id === videoImportId)
237 expect(videoImport.state.id).to.equal(VideoImportState.REJECTED)
238 expect(videoImport.state.label).to.equal('Rejected')
242 it('Should run filter:api.video.post-import-torrent.accept.result', async function () {
245 let videoImportId: number
249 name: 'title with bad word',
250 privacy: VideoPrivacy.PUBLIC,
251 channelId: servers[0].store.channel.id,
252 torrentfile: 'video-720p.torrent' as any
254 const body = await servers[0].imports.importVideo({ attributes })
255 videoImportId = body.id
258 await waitJobs(servers)
261 const { data: videoImports } = await servers[0].imports.getMyVideoImports()
263 const videoImport = videoImports.find(i => i.id === videoImportId)
265 expect(videoImport.state.id).to.equal(VideoImportState.REJECTED)
266 expect(videoImport.state.label).to.equal('Rejected')
271 describe('Video comments accept', function () {
273 it('Should run filter:api.video-thread.create.accept.result', async function () {
274 await servers[0].comments.createThread({
276 text: 'comment with bad word',
277 expectedStatus: HttpStatusCode.FORBIDDEN_403
281 it('Should run filter:api.video-comment-reply.create.accept.result', async function () {
282 const created = await servers[0].comments.createThread({ videoId: videoUUID, text: 'thread' })
283 threadId = created.id
285 await servers[0].comments.addReply({
287 toCommentId: threadId,
288 text: 'comment with bad word',
289 expectedStatus: HttpStatusCode.FORBIDDEN_403
291 await servers[0].comments.addReply({
293 toCommentId: threadId,
294 text: 'comment with good word',
295 expectedStatus: HttpStatusCode.OK_200
299 it('Should run filter:activity-pub.remote-video-comment.create.accept.result on a thread creation', async function () {
302 await servers[1].comments.createThread({ videoId: videoUUID, text: 'comment with bad word' })
304 await waitJobs(servers)
307 const thread = await servers[0].comments.listThreads({ videoId: videoUUID })
308 expect(thread.data).to.have.lengthOf(1)
309 expect(thread.data[0].text).to.not.include(' bad ')
313 const thread = await servers[1].comments.listThreads({ videoId: videoUUID })
314 expect(thread.data).to.have.lengthOf(2)
318 it('Should run filter:activity-pub.remote-video-comment.create.accept.result on a reply creation', async function () {
321 const { data } = await servers[1].comments.listThreads({ videoId: videoUUID })
322 const threadIdServer2 = data.find(t => t.text === 'thread').id
324 await servers[1].comments.addReply({
326 toCommentId: threadIdServer2,
327 text: 'comment with bad word'
330 await waitJobs(servers)
333 const tree = await servers[0].comments.getThread({ videoId: videoUUID, threadId })
334 expect(tree.children).to.have.lengthOf(1)
335 expect(tree.children[0].comment.text).to.not.include(' bad ')
339 const tree = await servers[1].comments.getThread({ videoId: videoUUID, threadId: threadIdServer2 })
340 expect(tree.children).to.have.lengthOf(2)
345 describe('Video comments', function () {
347 it('Should run filter:api.video-threads.list.params', async function () {
348 const { data } = await servers[0].comments.listThreads({ videoId: videoUUID, start: 0, count: 0 })
350 // our plugin do +1 to the count parameter
351 expect(data).to.have.lengthOf(1)
354 it('Should run filter:api.video-threads.list.result', async function () {
355 const { total } = await servers[0].comments.listThreads({ videoId: videoUUID, start: 0, count: 0 })
357 // Plugin do +1 to the total result
358 expect(total).to.equal(2)
361 it('Should run filter:api.video-thread-comments.list.params')
363 it('Should run filter:api.video-thread-comments.list.result', async function () {
364 const thread = await servers[0].comments.getThread({ videoId: videoUUID, threadId })
366 expect(thread.comment.text.endsWith(' <3')).to.be.true
369 it('Should run filter:api.overviews.videos.list.{params,result}', async function () {
370 await servers[0].overviews.getVideos({ page: 1 })
372 // 3 because we get 3 samples per page
373 await servers[0].servers.waitUntilLog('Run hook filter:api.overviews.videos.list.params', 3)
374 await servers[0].servers.waitUntilLog('Run hook filter:api.overviews.videos.list.result', 3)
378 describe('filter:video.auto-blacklist.result', function () {
380 async function checkIsBlacklisted (id: number | string, value: boolean) {
381 const video = await servers[0].videos.getWithToken({ id })
382 expect(video.blacklisted).to.equal(value)
385 it('Should blacklist on upload', async function () {
386 const { uuid } = await servers[0].videos.upload({ attributes: { name: 'video please blacklist me' } })
387 await checkIsBlacklisted(uuid, true)
390 it('Should blacklist on import', async function () {
394 name: 'video please blacklist me',
395 targetUrl: FIXTURE_URLS.goodVideo,
396 channelId: servers[0].store.channel.id
398 const body = await servers[0].imports.importVideo({ attributes })
399 await checkIsBlacklisted(body.video.uuid, true)
402 it('Should blacklist on update', async function () {
403 const { uuid } = await servers[0].videos.upload({ attributes: { name: 'video' } })
404 await checkIsBlacklisted(uuid, false)
406 await servers[0].videos.update({ id: uuid, attributes: { name: 'please blacklist me' } })
407 await checkIsBlacklisted(uuid, true)
410 it('Should blacklist on remote upload', async function () {
413 const { uuid } = await servers[1].videos.upload({ attributes: { name: 'remote please blacklist me' } })
414 await waitJobs(servers)
416 await checkIsBlacklisted(uuid, true)
419 it('Should blacklist on remote update', async function () {
422 const { uuid } = await servers[1].videos.upload({ attributes: { name: 'video' } })
423 await waitJobs(servers)
425 await checkIsBlacklisted(uuid, false)
427 await servers[1].videos.update({ id: uuid, attributes: { name: 'please blacklist me' } })
428 await waitJobs(servers)
430 await checkIsBlacklisted(uuid, true)
434 describe('Should run filter:api.user.signup.allowed.result', function () {
436 before(async function () {
437 await servers[0].config.updateExistingSubConfig({ newConfig: { signup: { requiresApproval: false } } })
440 it('Should run on config endpoint', async function () {
441 const body = await servers[0].config.getConfig()
442 expect(body.signup.allowed).to.be.true
445 it('Should allow a signup', async function () {
446 await servers[0].registrations.register({ username: 'john1' })
449 it('Should not allow a signup', async function () {
450 const res = await servers[0].registrations.register({
452 expectedStatus: HttpStatusCode.FORBIDDEN_403
455 expect(res.body.error).to.equal('No jma 1')
459 describe('Should run filter:api.user.request-signup.allowed.result', function () {
461 before(async function () {
462 await servers[0].config.updateExistingSubConfig({ newConfig: { signup: { requiresApproval: true } } })
465 it('Should run on config endpoint', async function () {
466 const body = await servers[0].config.getConfig()
467 expect(body.signup.allowed).to.be.true
470 it('Should allow a signup request', async function () {
471 await servers[0].registrations.requestRegistration({ username: 'john2', registrationReason: 'tt' })
474 it('Should not allow a signup request', async function () {
475 const body = await servers[0].registrations.requestRegistration({
477 registrationReason: 'tt',
478 expectedStatus: HttpStatusCode.FORBIDDEN_403
481 expect((body as unknown as PeerTubeProblemDocument).error).to.equal('No jma 2')
485 describe('Download hooks', function () {
486 const downloadVideos: VideoDetails[] = []
487 let downloadVideo2Token: string
489 before(async function () {
492 await servers[0].config.updateCustomSubConfig({
505 const uuids: string[] = []
507 for (const name of [ 'bad torrent', 'bad file', 'bad playlist file' ]) {
508 const uuid = (await servers[0].videos.quickUpload({ name })).uuid
512 await waitJobs(servers)
514 for (const uuid of uuids) {
515 downloadVideos.push(await servers[0].videos.get({ id: uuid }))
518 downloadVideo2Token = await servers[0].videoToken.getVideoFileToken({ videoId: downloadVideos[2].uuid })
521 it('Should run filter:api.download.torrent.allowed.result', async function () {
522 const res = await makeRawRequest({ url: downloadVideos[0].files[0].torrentDownloadUrl, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
523 expect(res.body.error).to.equal('Liu Bei')
525 await makeRawRequest({ url: downloadVideos[1].files[0].torrentDownloadUrl, expectedStatus: HttpStatusCode.OK_200 })
526 await makeRawRequest({ url: downloadVideos[2].files[0].torrentDownloadUrl, expectedStatus: HttpStatusCode.OK_200 })
529 it('Should run filter:api.download.video.allowed.result', async function () {
531 const refused = downloadVideos[1].files[0].fileDownloadUrl
533 downloadVideos[0].files[0].fileDownloadUrl,
534 downloadVideos[2].files[0].fileDownloadUrl
537 const res = await makeRawRequest({ url: refused, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
538 expect(res.body.error).to.equal('Cao Cao')
540 for (const url of allowed) {
541 await makeRawRequest({ url, expectedStatus: HttpStatusCode.OK_200 })
542 await makeRawRequest({ url, expectedStatus: HttpStatusCode.OK_200 })
547 const refused = downloadVideos[2].streamingPlaylists[0].files[0].fileDownloadUrl
550 downloadVideos[2].files[0].fileDownloadUrl,
551 downloadVideos[0].streamingPlaylists[0].files[0].fileDownloadUrl,
552 downloadVideos[1].streamingPlaylists[0].files[0].fileDownloadUrl
555 // Only streaming playlist is refuse
556 const res = await makeRawRequest({ url: refused, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
557 expect(res.body.error).to.equal('Sun Jian')
559 // But not we there is a user in res
560 await makeRawRequest({ url: refused, token: servers[0].accessToken, expectedStatus: HttpStatusCode.OK_200 })
561 await makeRawRequest({ url: refused, query: { videoFileToken: downloadVideo2Token }, expectedStatus: HttpStatusCode.OK_200 })
564 for (const url of allowed) {
565 await makeRawRequest({ url, expectedStatus: HttpStatusCode.OK_200 })
571 describe('Embed filters', function () {
572 const embedVideos: VideoDetails[] = []
573 const embedPlaylists: VideoPlaylist[] = []
575 before(async function () {
578 await servers[0].config.disableTranscoding()
580 for (const name of [ 'bad embed', 'good embed' ]) {
582 const uuid = (await servers[0].videos.quickUpload({ name })).uuid
583 embedVideos.push(await servers[0].videos.get({ id: uuid }))
587 const attributes = { displayName: name, videoChannelId: servers[0].store.channel.id, privacy: VideoPlaylistPrivacy.PUBLIC }
588 const { id } = await servers[0].playlists.create({ attributes })
590 const playlist = await servers[0].playlists.get({ playlistId: id })
591 embedPlaylists.push(playlist)
596 it('Should run filter:html.embed.video.allowed.result', async function () {
597 const res = await makeGetRequest({ url: servers[0].url, path: embedVideos[0].embedPath, expectedStatus: HttpStatusCode.OK_200 })
598 expect(res.text).to.equal('Lu Bu')
601 it('Should run filter:html.embed.video-playlist.allowed.result', async function () {
602 const res = await makeGetRequest({ url: servers[0].url, path: embedPlaylists[0].embedPath, expectedStatus: HttpStatusCode.OK_200 })
603 expect(res.text).to.equal('Diao Chan')
607 describe('Search filters', function () {
609 before(async function () {
610 await servers[0].config.updateCustomSubConfig({
615 isDefaultSearch: false,
616 disableLocalSearch: false
623 it('Should run filter:api.search.videos.local.list.{params,result}', async function () {
624 await servers[0].search.advancedVideoSearch({
630 await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.local.list.params', 1)
631 await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.local.list.result', 1)
634 it('Should run filter:api.search.videos.index.list.{params,result}', async function () {
635 await servers[0].search.advancedVideoSearch({
638 searchTarget: 'search-index'
642 await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.local.list.params', 1)
643 await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.local.list.result', 1)
644 await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.index.list.params', 1)
645 await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.index.list.result', 1)
648 it('Should run filter:api.search.video-channels.local.list.{params,result}', async function () {
649 await servers[0].search.advancedChannelSearch({
655 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.local.list.params', 1)
656 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.local.list.result', 1)
659 it('Should run filter:api.search.video-channels.index.list.{params,result}', async function () {
660 await servers[0].search.advancedChannelSearch({
663 searchTarget: 'search-index'
667 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.local.list.params', 1)
668 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.local.list.result', 1)
669 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.index.list.params', 1)
670 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.index.list.result', 1)
673 it('Should run filter:api.search.video-playlists.local.list.{params,result}', async function () {
674 await servers[0].search.advancedPlaylistSearch({
680 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.params', 1)
681 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.result', 1)
684 it('Should run filter:api.search.video-playlists.index.list.{params,result}', async function () {
685 await servers[0].search.advancedPlaylistSearch({
688 searchTarget: 'search-index'
692 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.params', 1)
693 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.result', 1)
694 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.index.list.params', 1)
695 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.index.list.result', 1)
699 describe('Upload/import/live attributes filters', function () {
701 before(async function () {
702 await servers[0].config.enableLive({ transcoding: false, allowReplay: false })
703 await servers[0].config.enableImports()
704 await servers[0].config.disableTranscoding()
707 it('Should run filter:api.video.upload.video-attribute.result', async function () {
708 for (const mode of [ 'legacy' as 'legacy', 'resumable' as 'resumable' ]) {
709 const { id } = await servers[0].videos.upload({ attributes: { name: 'video', description: 'upload' }, mode })
711 const video = await servers[0].videos.get({ id })
712 expect(video.description).to.equal('upload - filter:api.video.upload.video-attribute.result')
716 it('Should run filter:api.video.import-url.video-attribute.result', async function () {
719 description: 'import url',
720 channelId: servers[0].store.channel.id,
721 targetUrl: FIXTURE_URLS.goodVideo,
722 privacy: VideoPrivacy.PUBLIC
724 const { video: { id } } = await servers[0].imports.importVideo({ attributes })
726 const video = await servers[0].videos.get({ id })
727 expect(video.description).to.equal('import url - filter:api.video.import-url.video-attribute.result')
730 it('Should run filter:api.video.import-torrent.video-attribute.result', async function () {
733 description: 'import torrent',
734 channelId: servers[0].store.channel.id,
735 magnetUri: FIXTURE_URLS.magnet,
736 privacy: VideoPrivacy.PUBLIC
738 const { video: { id } } = await servers[0].imports.importVideo({ attributes })
740 const video = await servers[0].videos.get({ id })
741 expect(video.description).to.equal('import torrent - filter:api.video.import-torrent.video-attribute.result')
744 it('Should run filter:api.video.live.video-attribute.result', async function () {
748 channelId: servers[0].store.channel.id,
749 privacy: VideoPrivacy.PUBLIC
751 const { id } = await servers[0].live.create({ fields })
753 const video = await servers[0].videos.get({ id })
754 expect(video.description).to.equal('live - filter:api.video.live.video-attribute.result')
758 describe('Stats filters', function () {
760 it('Should run filter:api.server.stats.get.result', async function () {
761 const data = await servers[0].stats.get()
763 expect((data as any).customStats).to.equal(14)
768 describe('Job queue filters', function () {
769 let videoUUID: string
771 before(async function () {
772 this.timeout(120_000)
774 await servers[0].config.enableMinimumTranscoding()
775 const { uuid } = await servers[0].videos.quickUpload({ name: 'studio' })
777 const video = await servers[0].videos.get({ id: uuid })
778 expect(video.duration).at.least(2)
779 videoUUID = video.uuid
781 await waitJobs(servers)
783 await servers[0].config.enableStudio()
786 it('Should run filter:job-queue.process.params', async function () {
787 this.timeout(120_000)
789 await servers[0].videoStudio.createEditionTasks({
795 file: 'video_very_short_240p.mp4'
801 await waitJobs(servers)
803 await servers[0].servers.waitUntilLog('Run hook filter:job-queue.process.params', 1, false)
805 const video = await servers[0].videos.get({ id: videoUUID })
806 expect(video.duration).at.most(2)
809 it('Should run filter:job-queue.process.result', async function () {
810 await servers[0].servers.waitUntilLog('Run hook filter:job-queue.process.result', 1, false)
814 describe('Transcoding filters', async function () {
816 it('Should run filter:transcoding.auto.resolutions-to-transcode.result', async function () {
817 const { uuid } = await servers[0].videos.quickUpload({ name: 'transcode-filter' })
819 await waitJobs(servers)
821 const video = await servers[0].videos.get({ id: uuid })
822 expect(video.files).to.have.lengthOf(2)
823 expect(video.files.find(f => f.resolution.id === 100 as any)).to.exist
827 describe('Video channel filters', async function () {
829 it('Should run filter:api.video-channels.list.params', async function () {
830 const { data } = await servers[0].channels.list({ start: 0, count: 0 })
832 // plugin do +1 to the count parameter
833 expect(data).to.have.lengthOf(1)
836 it('Should run filter:api.video-channels.list.result', async function () {
837 const { total } = await servers[0].channels.list({ start: 0, count: 1 })
839 // plugin do +1 to the total parameter
840 expect(total).to.equal(4)
843 it('Should run filter:api.video-channel.get.result', async function () {
844 const channel = await servers[0].channels.get({ channelName: 'root_channel' })
845 expect(channel.displayName).to.equal('Main root channel <3')
849 after(async function () {
850 await cleanupTests(servers)