aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/plugins')
-rw-r--r--server/tests/plugins/action-hooks.ts40
1 files changed, 39 insertions, 1 deletions
diff --git a/server/tests/plugins/action-hooks.ts b/server/tests/plugins/action-hooks.ts
index ac9f2cea5..0f57ef7fe 100644
--- a/server/tests/plugins/action-hooks.ts
+++ b/server/tests/plugins/action-hooks.ts
@@ -1,13 +1,15 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import 'mocha'
4import { ServerHookName, VideoPrivacy } from '@shared/models' 4import { ServerHookName, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models'
5import { 5import {
6 addVideoCommentReply, 6 addVideoCommentReply,
7 addVideoCommentThread, 7 addVideoCommentThread,
8 addVideoInPlaylist,
8 blockUser, 9 blockUser,
9 createLive, 10 createLive,
10 createUser, 11 createUser,
12 createVideoPlaylist,
11 deleteVideoComment, 13 deleteVideoComment,
12 getPluginTestPath, 14 getPluginTestPath,
13 installPlugin, 15 installPlugin,
@@ -69,6 +71,7 @@ describe('Test plugin action hooks', function () {
69 }) 71 })
70 72
71 describe('Videos hooks', function () { 73 describe('Videos hooks', function () {
74
72 it('Should run action:api.video.uploaded', async function () { 75 it('Should run action:api.video.uploaded', async function () {
73 const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video' }) 76 const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video' })
74 videoUUID = res.body.video.uuid 77 videoUUID = res.body.video.uuid
@@ -177,6 +180,41 @@ describe('Test plugin action hooks', function () {
177 }) 180 })
178 }) 181 })
179 182
183 describe('Playlist hooks', function () {
184 let playlistId: number
185 let videoId: number
186
187 before(async function () {
188 {
189 const res = await createVideoPlaylist({
190 url: servers[0].url,
191 token: servers[0].accessToken,
192 playlistAttrs: {
193 displayName: 'My playlist',
194 privacy: VideoPlaylistPrivacy.PRIVATE
195 }
196 })
197 playlistId = res.body.videoPlaylist.id
198 }
199
200 {
201 const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'my super name' })
202 videoId = res.body.video.id
203 }
204 })
205
206 it('Should run action:api.video-playlist-element.created', async function () {
207 await addVideoInPlaylist({
208 url: servers[0].url,
209 token: servers[0].accessToken,
210 playlistId,
211 elementAttrs: { videoId }
212 })
213
214 await checkHook('action:api.video-playlist-element.created')
215 })
216 })
217
180 after(async function () { 218 after(async function () {
181 await cleanupTests(servers) 219 await cleanupTests(servers)
182 }) 220 })