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.ts31
1 files changed, 28 insertions, 3 deletions
diff --git a/server/tests/plugins/action-hooks.ts b/server/tests/plugins/action-hooks.ts
index e8d03ee0f..34b4e1891 100644
--- a/server/tests/plugins/action-hooks.ts
+++ b/server/tests/plugins/action-hooks.ts
@@ -9,7 +9,9 @@ import {
9 PeerTubeServer, 9 PeerTubeServer,
10 PluginsCommand, 10 PluginsCommand,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 setDefaultVideoChannel 12 setDefaultVideoChannel,
13 stopFfmpeg,
14 waitJobs
13} from '@shared/server-commands' 15} from '@shared/server-commands'
14 16
15describe('Test plugin action hooks', function () { 17describe('Test plugin action hooks', function () {
@@ -17,8 +19,8 @@ describe('Test plugin action hooks', function () {
17 let videoUUID: string 19 let videoUUID: string
18 let threadId: number 20 let threadId: number
19 21
20 function checkHook (hook: ServerHookName, strictCount = true) { 22 function checkHook (hook: ServerHookName, strictCount = true, count = 1) {
21 return servers[0].servers.waitUntilLog('Run hook ' + hook, 1, strictCount) 23 return servers[0].servers.waitUntilLog('Run hook ' + hook, count, strictCount)
22 } 24 }
23 25
24 before(async function () { 26 before(async function () {
@@ -115,6 +117,29 @@ describe('Test plugin action hooks', function () {
115 117
116 await checkHook('action:api.live-video.created') 118 await checkHook('action:api.live-video.created')
117 }) 119 })
120
121 it('Should run action:live.video.state.updated', async function () {
122 this.timeout(60000)
123
124 const attributes = {
125 name: 'live',
126 privacy: VideoPrivacy.PUBLIC,
127 channelId: servers[0].store.channel.id
128 }
129
130 const { uuid: liveVideoId } = await servers[0].live.create({ fields: attributes })
131 const ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoId })
132 await servers[0].live.waitUntilPublished({ videoId: liveVideoId })
133 await waitJobs(servers)
134
135 await checkHook('action:live.video.state.updated', true, 1)
136
137 await stopFfmpeg(ffmpegCommand)
138 await servers[0].live.waitUntilEnded({ videoId: liveVideoId })
139 await waitJobs(servers)
140
141 await checkHook('action:live.video.state.updated', true, 2)
142 })
118 }) 143 })
119 144
120 describe('Comments hooks', function () { 145 describe('Comments hooks', function () {