aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/notifications/comments-notifications.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-15 10:02:54 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commitd23dd9fbfc4d26026352c10f81d2795ceaf2908a (patch)
treeda82286d423c5e834a1ee2dcd5970076b8263cf1 /server/tests/api/notifications/comments-notifications.ts
parent7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0 (diff)
downloadPeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.tar.gz
PeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.tar.zst
PeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.zip
Introduce videos command
Diffstat (limited to 'server/tests/api/notifications/comments-notifications.ts')
-rw-r--r--server/tests/api/notifications/comments-notifications.ts46
1 files changed, 15 insertions, 31 deletions
diff --git a/server/tests/api/notifications/comments-notifications.ts b/server/tests/api/notifications/comments-notifications.ts
index 62569f810..a74b38e8a 100644
--- a/server/tests/api/notifications/comments-notifications.ts
+++ b/server/tests/api/notifications/comments-notifications.ts
@@ -10,7 +10,6 @@ import {
10 MockSmtpServer, 10 MockSmtpServer,
11 prepareNotificationsTest, 11 prepareNotificationsTest,
12 ServerInfo, 12 ServerInfo,
13 uploadVideo,
14 waitJobs 13 waitJobs
15} from '@shared/extra-utils' 14} from '@shared/extra-utils'
16import { UserNotification } from '@shared/models' 15import { UserNotification } from '@shared/models'
@@ -53,8 +52,7 @@ describe('Test comments notifications', function () {
53 it('Should not send a new comment notification after a comment on another video', async function () { 52 it('Should not send a new comment notification after a comment on another video', async function () {
54 this.timeout(20000) 53 this.timeout(20000)
55 54
56 const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'super video' }) 55 const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'super video' } })
57 const uuid = resVideo.body.video.uuid
58 56
59 const created = await servers[0].commentsCommand.createThread({ videoId: uuid, text: 'comment' }) 57 const created = await servers[0].commentsCommand.createThread({ videoId: uuid, text: 'comment' })
60 const commentId = created.id 58 const commentId = created.id
@@ -66,8 +64,7 @@ describe('Test comments notifications', function () {
66 it('Should not send a new comment notification if I comment my own video', async function () { 64 it('Should not send a new comment notification if I comment my own video', async function () {
67 this.timeout(20000) 65 this.timeout(20000)
68 66
69 const resVideo = await uploadVideo(servers[0].url, userToken, { name: 'super video' }) 67 const { uuid } = await servers[0].videosCommand.upload({ token: userToken, attributes: { name: 'super video' } })
70 const uuid = resVideo.body.video.uuid
71 68
72 const created = await servers[0].commentsCommand.createThread({ token: userToken, videoId: uuid, text: 'comment' }) 69 const created = await servers[0].commentsCommand.createThread({ token: userToken, videoId: uuid, text: 'comment' })
73 const commentId = created.id 70 const commentId = created.id
@@ -81,8 +78,7 @@ describe('Test comments notifications', function () {
81 78
82 await servers[0].blocklistCommand.addToMyBlocklist({ token: userToken, account: 'root' }) 79 await servers[0].blocklistCommand.addToMyBlocklist({ token: userToken, account: 'root' })
83 80
84 const resVideo = await uploadVideo(servers[0].url, userToken, { name: 'super video' }) 81 const { uuid } = await servers[0].videosCommand.upload({ token: userToken, attributes: { name: 'super video' } })
85 const uuid = resVideo.body.video.uuid
86 82
87 const created = await servers[0].commentsCommand.createThread({ videoId: uuid, text: 'comment' }) 83 const created = await servers[0].commentsCommand.createThread({ videoId: uuid, text: 'comment' })
88 const commentId = created.id 84 const commentId = created.id
@@ -96,8 +92,7 @@ describe('Test comments notifications', function () {
96 it('Should send a new comment notification after a local comment on my video', async function () { 92 it('Should send a new comment notification after a local comment on my video', async function () {
97 this.timeout(20000) 93 this.timeout(20000)
98 94
99 const resVideo = await uploadVideo(servers[0].url, userToken, { name: 'super video' }) 95 const { uuid } = await servers[0].videosCommand.upload({ token: userToken, attributes: { name: 'super video' } })
100 const uuid = resVideo.body.video.uuid
101 96
102 const created = await servers[0].commentsCommand.createThread({ videoId: uuid, text: 'comment' }) 97 const created = await servers[0].commentsCommand.createThread({ videoId: uuid, text: 'comment' })
103 const commentId = created.id 98 const commentId = created.id
@@ -109,8 +104,7 @@ describe('Test comments notifications', function () {
109 it('Should send a new comment notification after a remote comment on my video', async function () { 104 it('Should send a new comment notification after a remote comment on my video', async function () {
110 this.timeout(20000) 105 this.timeout(20000)
111 106
112 const resVideo = await uploadVideo(servers[0].url, userToken, { name: 'super video' }) 107 const { uuid } = await servers[0].videosCommand.upload({ token: userToken, attributes: { name: 'super video' } })
113 const uuid = resVideo.body.video.uuid
114 108
115 await waitJobs(servers) 109 await waitJobs(servers)
116 110
@@ -128,8 +122,7 @@ describe('Test comments notifications', function () {
128 it('Should send a new comment notification after a local reply on my video', async function () { 122 it('Should send a new comment notification after a local reply on my video', async function () {
129 this.timeout(20000) 123 this.timeout(20000)
130 124
131 const resVideo = await uploadVideo(servers[0].url, userToken, { name: 'super video' }) 125 const { uuid } = await servers[0].videosCommand.upload({ token: userToken, attributes: { name: 'super video' } })
132 const uuid = resVideo.body.video.uuid
133 126
134 const { id: threadId } = await servers[0].commentsCommand.createThread({ videoId: uuid, text: 'comment' }) 127 const { id: threadId } = await servers[0].commentsCommand.createThread({ videoId: uuid, text: 'comment' })
135 128
@@ -142,8 +135,7 @@ describe('Test comments notifications', function () {
142 it('Should send a new comment notification after a remote reply on my video', async function () { 135 it('Should send a new comment notification after a remote reply on my video', async function () {
143 this.timeout(20000) 136 this.timeout(20000)
144 137
145 const resVideo = await uploadVideo(servers[0].url, userToken, { name: 'super video' }) 138 const { uuid } = await servers[0].videosCommand.upload({ token: userToken, attributes: { name: 'super video' } })
146 const uuid = resVideo.body.video.uuid
147 await waitJobs(servers) 139 await waitJobs(servers)
148 140
149 { 141 {
@@ -169,8 +161,7 @@ describe('Test comments notifications', function () {
169 it('Should convert markdown in comment to html', async function () { 161 it('Should convert markdown in comment to html', async function () {
170 this.timeout(20000) 162 this.timeout(20000)
171 163
172 const resVideo = await uploadVideo(servers[0].url, userToken, { name: 'cool video' }) 164 const { uuid } = await servers[0].videosCommand.upload({ token: userToken, attributes: { name: 'cool video' } })
173 const uuid = resVideo.body.video.uuid
174 165
175 await servers[0].commentsCommand.createThread({ videoId: uuid, text: commentText }) 166 await servers[0].commentsCommand.createThread({ videoId: uuid, text: commentText })
176 167
@@ -199,8 +190,7 @@ describe('Test comments notifications', function () {
199 it('Should not send a new mention comment notification if I mention the video owner', async function () { 190 it('Should not send a new mention comment notification if I mention the video owner', async function () {
200 this.timeout(10000) 191 this.timeout(10000)
201 192
202 const resVideo = await uploadVideo(servers[0].url, userToken, { name: 'super video' }) 193 const { uuid } = await servers[0].videosCommand.upload({ token: userToken, attributes: { name: 'super video' } })
203 const uuid = resVideo.body.video.uuid
204 194
205 const { id: commentId } = await servers[0].commentsCommand.createThread({ videoId: uuid, text: '@user_1 hello' }) 195 const { id: commentId } = await servers[0].commentsCommand.createThread({ videoId: uuid, text: '@user_1 hello' })
206 196
@@ -211,8 +201,7 @@ describe('Test comments notifications', function () {
211 it('Should not send a new mention comment notification if I mention myself', async function () { 201 it('Should not send a new mention comment notification if I mention myself', async function () {
212 this.timeout(10000) 202 this.timeout(10000)
213 203
214 const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'super video' }) 204 const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'super video' } })
215 const uuid = resVideo.body.video.uuid
216 205
217 const { id: commentId } = await servers[0].commentsCommand.createThread({ token: userToken, videoId: uuid, text: '@user_1 hello' }) 206 const { id: commentId } = await servers[0].commentsCommand.createThread({ token: userToken, videoId: uuid, text: '@user_1 hello' })
218 207
@@ -225,8 +214,7 @@ describe('Test comments notifications', function () {
225 214
226 await servers[0].blocklistCommand.addToMyBlocklist({ token: userToken, account: 'root' }) 215 await servers[0].blocklistCommand.addToMyBlocklist({ token: userToken, account: 'root' })
227 216
228 const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'super video' }) 217 const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'super video' } })
229 const uuid = resVideo.body.video.uuid
230 218
231 const { id: commentId } = await servers[0].commentsCommand.createThread({ videoId: uuid, text: '@user_1 hello' }) 219 const { id: commentId } = await servers[0].commentsCommand.createThread({ videoId: uuid, text: '@user_1 hello' })
232 220
@@ -239,8 +227,7 @@ describe('Test comments notifications', function () {
239 it('Should not send a new mention notification if the remote account mention a local account', async function () { 227 it('Should not send a new mention notification if the remote account mention a local account', async function () {
240 this.timeout(20000) 228 this.timeout(20000)
241 229
242 const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'super video' }) 230 const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'super video' } })
243 const uuid = resVideo.body.video.uuid
244 231
245 await waitJobs(servers) 232 await waitJobs(servers)
246 const { id: threadId } = await servers[1].commentsCommand.createThread({ videoId: uuid, text: '@user_1 hello' }) 233 const { id: threadId } = await servers[1].commentsCommand.createThread({ videoId: uuid, text: '@user_1 hello' })
@@ -252,8 +239,7 @@ describe('Test comments notifications', function () {
252 it('Should send a new mention notification after local comments', async function () { 239 it('Should send a new mention notification after local comments', async function () {
253 this.timeout(10000) 240 this.timeout(10000)
254 241
255 const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'super video' }) 242 const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'super video' } })
256 const uuid = resVideo.body.video.uuid
257 243
258 const { id: threadId } = await servers[0].commentsCommand.createThread({ videoId: uuid, text: '@user_1 hellotext: 1' }) 244 const { id: threadId } = await servers[0].commentsCommand.createThread({ videoId: uuid, text: '@user_1 hellotext: 1' })
259 245
@@ -269,8 +255,7 @@ describe('Test comments notifications', function () {
269 it('Should send a new mention notification after remote comments', async function () { 255 it('Should send a new mention notification after remote comments', async function () {
270 this.timeout(20000) 256 this.timeout(20000)
271 257
272 const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'super video' }) 258 const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'super video' } })
273 const uuid = resVideo.body.video.uuid
274 259
275 await waitJobs(servers) 260 await waitJobs(servers)
276 261
@@ -301,8 +286,7 @@ describe('Test comments notifications', function () {
301 it('Should convert markdown in comment to html', async function () { 286 it('Should convert markdown in comment to html', async function () {
302 this.timeout(10000) 287 this.timeout(10000)
303 288
304 const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'super video' }) 289 const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'super video' } })
305 const uuid = resVideo.body.video.uuid
306 290
307 const { id: threadId } = await servers[0].commentsCommand.createThread({ videoId: uuid, text: '@user_1 hello 1' }) 291 const { id: threadId } = await servers[0].commentsCommand.createThread({ videoId: uuid, text: '@user_1 hello 1' })
308 292