diff options
Diffstat (limited to 'server/tests/api/notifications/comments-notifications.ts')
-rw-r--r-- | server/tests/api/notifications/comments-notifications.ts | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/server/tests/api/notifications/comments-notifications.ts b/server/tests/api/notifications/comments-notifications.ts index a74b38e8a..133b6340f 100644 --- a/server/tests/api/notifications/comments-notifications.ts +++ b/server/tests/api/notifications/comments-notifications.ts | |||
@@ -52,9 +52,9 @@ describe('Test comments notifications', function () { | |||
52 | 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 () { |
53 | this.timeout(20000) | 53 | this.timeout(20000) |
54 | 54 | ||
55 | const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'super video' } }) | 55 | const { uuid } = await servers[0].videos.upload({ attributes: { name: 'super video' } }) |
56 | 56 | ||
57 | const created = await servers[0].commentsCommand.createThread({ videoId: uuid, text: 'comment' }) | 57 | const created = await servers[0].comments.createThread({ videoId: uuid, text: 'comment' }) |
58 | const commentId = created.id | 58 | const commentId = created.id |
59 | 59 | ||
60 | await waitJobs(servers) | 60 | await waitJobs(servers) |
@@ -64,9 +64,9 @@ describe('Test comments notifications', function () { | |||
64 | 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 () { |
65 | this.timeout(20000) | 65 | this.timeout(20000) |
66 | 66 | ||
67 | const { uuid } = await servers[0].videosCommand.upload({ token: userToken, attributes: { name: 'super video' } }) | 67 | const { uuid } = await servers[0].videos.upload({ token: userToken, attributes: { name: 'super video' } }) |
68 | 68 | ||
69 | const created = await servers[0].commentsCommand.createThread({ token: userToken, videoId: uuid, text: 'comment' }) | 69 | const created = await servers[0].comments.createThread({ token: userToken, videoId: uuid, text: 'comment' }) |
70 | const commentId = created.id | 70 | const commentId = created.id |
71 | 71 | ||
72 | await waitJobs(servers) | 72 | await waitJobs(servers) |
@@ -76,25 +76,25 @@ describe('Test comments notifications', function () { | |||
76 | it('Should not send a new comment notification if the account is muted', async function () { | 76 | it('Should not send a new comment notification if the account is muted', async function () { |
77 | this.timeout(20000) | 77 | this.timeout(20000) |
78 | 78 | ||
79 | await servers[0].blocklistCommand.addToMyBlocklist({ token: userToken, account: 'root' }) | 79 | await servers[0].blocklist.addToMyBlocklist({ token: userToken, account: 'root' }) |
80 | 80 | ||
81 | const { uuid } = await servers[0].videosCommand.upload({ token: userToken, attributes: { name: 'super video' } }) | 81 | const { uuid } = await servers[0].videos.upload({ token: userToken, attributes: { name: 'super video' } }) |
82 | 82 | ||
83 | const created = await servers[0].commentsCommand.createThread({ videoId: uuid, text: 'comment' }) | 83 | const created = await servers[0].comments.createThread({ videoId: uuid, text: 'comment' }) |
84 | const commentId = created.id | 84 | const commentId = created.id |
85 | 85 | ||
86 | await waitJobs(servers) | 86 | await waitJobs(servers) |
87 | await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'absence') | 87 | await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'absence') |
88 | 88 | ||
89 | await servers[0].blocklistCommand.removeFromMyBlocklist({ token: userToken, account: 'root' }) | 89 | await servers[0].blocklist.removeFromMyBlocklist({ token: userToken, account: 'root' }) |
90 | }) | 90 | }) |
91 | 91 | ||
92 | 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 () { |
93 | this.timeout(20000) | 93 | this.timeout(20000) |
94 | 94 | ||
95 | const { uuid } = await servers[0].videosCommand.upload({ token: userToken, attributes: { name: 'super video' } }) | 95 | const { uuid } = await servers[0].videos.upload({ token: userToken, attributes: { name: 'super video' } }) |
96 | 96 | ||
97 | const created = await servers[0].commentsCommand.createThread({ videoId: uuid, text: 'comment' }) | 97 | const created = await servers[0].comments.createThread({ videoId: uuid, text: 'comment' }) |
98 | const commentId = created.id | 98 | const commentId = created.id |
99 | 99 | ||
100 | await waitJobs(servers) | 100 | await waitJobs(servers) |
@@ -104,15 +104,15 @@ describe('Test comments notifications', function () { | |||
104 | 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 () { |
105 | this.timeout(20000) | 105 | this.timeout(20000) |
106 | 106 | ||
107 | const { uuid } = await servers[0].videosCommand.upload({ token: userToken, attributes: { name: 'super video' } }) | 107 | const { uuid } = await servers[0].videos.upload({ token: userToken, attributes: { name: 'super video' } }) |
108 | 108 | ||
109 | await waitJobs(servers) | 109 | await waitJobs(servers) |
110 | 110 | ||
111 | await servers[1].commentsCommand.createThread({ videoId: uuid, text: 'comment' }) | 111 | await servers[1].comments.createThread({ videoId: uuid, text: 'comment' }) |
112 | 112 | ||
113 | await waitJobs(servers) | 113 | await waitJobs(servers) |
114 | 114 | ||
115 | const { data } = await servers[0].commentsCommand.listThreads({ videoId: uuid }) | 115 | const { data } = await servers[0].comments.listThreads({ videoId: uuid }) |
116 | expect(data).to.have.lengthOf(1) | 116 | expect(data).to.have.lengthOf(1) |
117 | 117 | ||
118 | const commentId = data[0].id | 118 | const commentId = data[0].id |
@@ -122,11 +122,11 @@ describe('Test comments notifications', function () { | |||
122 | 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 () { |
123 | this.timeout(20000) | 123 | this.timeout(20000) |
124 | 124 | ||
125 | const { uuid } = await servers[0].videosCommand.upload({ token: userToken, attributes: { name: 'super video' } }) | 125 | const { uuid } = await servers[0].videos.upload({ token: userToken, attributes: { name: 'super video' } }) |
126 | 126 | ||
127 | const { id: threadId } = await servers[0].commentsCommand.createThread({ videoId: uuid, text: 'comment' }) | 127 | const { id: threadId } = await servers[0].comments.createThread({ videoId: uuid, text: 'comment' }) |
128 | 128 | ||
129 | const { id: commentId } = await servers[0].commentsCommand.addReply({ videoId: uuid, toCommentId: threadId, text: 'reply' }) | 129 | const { id: commentId } = await servers[0].comments.addReply({ videoId: uuid, toCommentId: threadId, text: 'reply' }) |
130 | 130 | ||
131 | await waitJobs(servers) | 131 | await waitJobs(servers) |
132 | await checkNewCommentOnMyVideo(baseParams, uuid, commentId, threadId, 'presence') | 132 | await checkNewCommentOnMyVideo(baseParams, uuid, commentId, threadId, 'presence') |
@@ -135,22 +135,22 @@ describe('Test comments notifications', function () { | |||
135 | 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 () { |
136 | this.timeout(20000) | 136 | this.timeout(20000) |
137 | 137 | ||
138 | const { uuid } = await servers[0].videosCommand.upload({ token: userToken, attributes: { name: 'super video' } }) | 138 | const { uuid } = await servers[0].videos.upload({ token: userToken, attributes: { name: 'super video' } }) |
139 | await waitJobs(servers) | 139 | await waitJobs(servers) |
140 | 140 | ||
141 | { | 141 | { |
142 | const created = await servers[1].commentsCommand.createThread({ videoId: uuid, text: 'comment' }) | 142 | const created = await servers[1].comments.createThread({ videoId: uuid, text: 'comment' }) |
143 | const threadId = created.id | 143 | const threadId = created.id |
144 | await servers[1].commentsCommand.addReply({ videoId: uuid, toCommentId: threadId, text: 'reply' }) | 144 | await servers[1].comments.addReply({ videoId: uuid, toCommentId: threadId, text: 'reply' }) |
145 | } | 145 | } |
146 | 146 | ||
147 | await waitJobs(servers) | 147 | await waitJobs(servers) |
148 | 148 | ||
149 | const { data } = await servers[0].commentsCommand.listThreads({ videoId: uuid }) | 149 | const { data } = await servers[0].comments.listThreads({ videoId: uuid }) |
150 | expect(data).to.have.lengthOf(1) | 150 | expect(data).to.have.lengthOf(1) |
151 | 151 | ||
152 | const threadId = data[0].id | 152 | const threadId = data[0].id |
153 | const tree = await servers[0].commentsCommand.getThread({ videoId: uuid, threadId }) | 153 | const tree = await servers[0].comments.getThread({ videoId: uuid, threadId }) |
154 | 154 | ||
155 | expect(tree.children).to.have.lengthOf(1) | 155 | expect(tree.children).to.have.lengthOf(1) |
156 | const commentId = tree.children[0].comment.id | 156 | const commentId = tree.children[0].comment.id |
@@ -161,9 +161,9 @@ describe('Test comments notifications', function () { | |||
161 | it('Should convert markdown in comment to html', async function () { | 161 | it('Should convert markdown in comment to html', async function () { |
162 | this.timeout(20000) | 162 | this.timeout(20000) |
163 | 163 | ||
164 | const { uuid } = await servers[0].videosCommand.upload({ token: userToken, attributes: { name: 'cool video' } }) | 164 | const { uuid } = await servers[0].videos.upload({ token: userToken, attributes: { name: 'cool video' } }) |
165 | 165 | ||
166 | await servers[0].commentsCommand.createThread({ videoId: uuid, text: commentText }) | 166 | await servers[0].comments.createThread({ videoId: uuid, text: commentText }) |
167 | 167 | ||
168 | await waitJobs(servers) | 168 | await waitJobs(servers) |
169 | 169 | ||
@@ -183,16 +183,16 @@ describe('Test comments notifications', function () { | |||
183 | token: userToken | 183 | token: userToken |
184 | } | 184 | } |
185 | 185 | ||
186 | await servers[0].usersCommand.updateMe({ displayName: 'super root name' }) | 186 | await servers[0].users.updateMe({ displayName: 'super root name' }) |
187 | await servers[1].usersCommand.updateMe({ displayName: 'super root 2 name' }) | 187 | await servers[1].users.updateMe({ displayName: 'super root 2 name' }) |
188 | }) | 188 | }) |
189 | 189 | ||
190 | 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 () { |
191 | this.timeout(10000) | 191 | this.timeout(10000) |
192 | 192 | ||
193 | const { uuid } = await servers[0].videosCommand.upload({ token: userToken, attributes: { name: 'super video' } }) | 193 | const { uuid } = await servers[0].videos.upload({ token: userToken, attributes: { name: 'super video' } }) |
194 | 194 | ||
195 | const { id: commentId } = await servers[0].commentsCommand.createThread({ videoId: uuid, text: '@user_1 hello' }) | 195 | const { id: commentId } = await servers[0].comments.createThread({ videoId: uuid, text: '@user_1 hello' }) |
196 | 196 | ||
197 | await waitJobs(servers) | 197 | await waitJobs(servers) |
198 | await checkCommentMention(baseParams, uuid, commentId, commentId, 'super root name', 'absence') | 198 | await checkCommentMention(baseParams, uuid, commentId, commentId, 'super root name', 'absence') |
@@ -201,9 +201,9 @@ describe('Test comments notifications', function () { | |||
201 | 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 () { |
202 | this.timeout(10000) | 202 | this.timeout(10000) |
203 | 203 | ||
204 | const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'super video' } }) | 204 | const { uuid } = await servers[0].videos.upload({ attributes: { name: 'super video' } }) |
205 | 205 | ||
206 | const { id: commentId } = await servers[0].commentsCommand.createThread({ token: userToken, videoId: uuid, text: '@user_1 hello' }) | 206 | const { id: commentId } = await servers[0].comments.createThread({ token: userToken, videoId: uuid, text: '@user_1 hello' }) |
207 | 207 | ||
208 | await waitJobs(servers) | 208 | await waitJobs(servers) |
209 | await checkCommentMention(baseParams, uuid, commentId, commentId, 'super root name', 'absence') | 209 | await checkCommentMention(baseParams, uuid, commentId, commentId, 'super root name', 'absence') |
@@ -212,25 +212,25 @@ describe('Test comments notifications', function () { | |||
212 | it('Should not send a new mention notification if the account is muted', async function () { | 212 | it('Should not send a new mention notification if the account is muted', async function () { |
213 | this.timeout(10000) | 213 | this.timeout(10000) |
214 | 214 | ||
215 | await servers[0].blocklistCommand.addToMyBlocklist({ token: userToken, account: 'root' }) | 215 | await servers[0].blocklist.addToMyBlocklist({ token: userToken, account: 'root' }) |
216 | 216 | ||
217 | const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'super video' } }) | 217 | const { uuid } = await servers[0].videos.upload({ attributes: { name: 'super video' } }) |
218 | 218 | ||
219 | const { id: commentId } = await servers[0].commentsCommand.createThread({ videoId: uuid, text: '@user_1 hello' }) | 219 | const { id: commentId } = await servers[0].comments.createThread({ videoId: uuid, text: '@user_1 hello' }) |
220 | 220 | ||
221 | await waitJobs(servers) | 221 | await waitJobs(servers) |
222 | await checkCommentMention(baseParams, uuid, commentId, commentId, 'super root name', 'absence') | 222 | await checkCommentMention(baseParams, uuid, commentId, commentId, 'super root name', 'absence') |
223 | 223 | ||
224 | await servers[0].blocklistCommand.removeFromMyBlocklist({ token: userToken, account: 'root' }) | 224 | await servers[0].blocklist.removeFromMyBlocklist({ token: userToken, account: 'root' }) |
225 | }) | 225 | }) |
226 | 226 | ||
227 | 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 () { |
228 | this.timeout(20000) | 228 | this.timeout(20000) |
229 | 229 | ||
230 | const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'super video' } }) | 230 | const { uuid } = await servers[0].videos.upload({ attributes: { name: 'super video' } }) |
231 | 231 | ||
232 | await waitJobs(servers) | 232 | await waitJobs(servers) |
233 | const { id: threadId } = await servers[1].commentsCommand.createThread({ videoId: uuid, text: '@user_1 hello' }) | 233 | const { id: threadId } = await servers[1].comments.createThread({ videoId: uuid, text: '@user_1 hello' }) |
234 | 234 | ||
235 | await waitJobs(servers) | 235 | await waitJobs(servers) |
236 | await checkCommentMention(baseParams, uuid, threadId, threadId, 'super root 2 name', 'absence') | 236 | await checkCommentMention(baseParams, uuid, threadId, threadId, 'super root 2 name', 'absence') |
@@ -239,14 +239,14 @@ describe('Test comments notifications', function () { | |||
239 | 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 () { |
240 | this.timeout(10000) | 240 | this.timeout(10000) |
241 | 241 | ||
242 | const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'super video' } }) | 242 | const { uuid } = await servers[0].videos.upload({ attributes: { name: 'super video' } }) |
243 | 243 | ||
244 | const { id: threadId } = await servers[0].commentsCommand.createThread({ videoId: uuid, text: '@user_1 hellotext: 1' }) | 244 | const { id: threadId } = await servers[0].comments.createThread({ videoId: uuid, text: '@user_1 hellotext: 1' }) |
245 | 245 | ||
246 | await waitJobs(servers) | 246 | await waitJobs(servers) |
247 | await checkCommentMention(baseParams, uuid, threadId, threadId, 'super root name', 'presence') | 247 | await checkCommentMention(baseParams, uuid, threadId, threadId, 'super root name', 'presence') |
248 | 248 | ||
249 | const { id: commentId } = await servers[0].commentsCommand.addReply({ videoId: uuid, toCommentId: threadId, text: 'hello 2 @user_1' }) | 249 | const { id: commentId } = await servers[0].comments.addReply({ videoId: uuid, toCommentId: threadId, text: 'hello 2 @user_1' }) |
250 | 250 | ||
251 | await waitJobs(servers) | 251 | await waitJobs(servers) |
252 | await checkCommentMention(baseParams, uuid, commentId, threadId, 'super root name', 'presence') | 252 | await checkCommentMention(baseParams, uuid, commentId, threadId, 'super root name', 'presence') |
@@ -255,27 +255,27 @@ describe('Test comments notifications', function () { | |||
255 | 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 () { |
256 | this.timeout(20000) | 256 | this.timeout(20000) |
257 | 257 | ||
258 | const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'super video' } }) | 258 | const { uuid } = await servers[0].videos.upload({ attributes: { name: 'super video' } }) |
259 | 259 | ||
260 | await waitJobs(servers) | 260 | await waitJobs(servers) |
261 | 261 | ||
262 | const text1 = `hello @user_1@localhost:${servers[0].port} 1` | 262 | const text1 = `hello @user_1@localhost:${servers[0].port} 1` |
263 | const { id: server2ThreadId } = await servers[1].commentsCommand.createThread({ videoId: uuid, text: text1 }) | 263 | const { id: server2ThreadId } = await servers[1].comments.createThread({ videoId: uuid, text: text1 }) |
264 | 264 | ||
265 | await waitJobs(servers) | 265 | await waitJobs(servers) |
266 | 266 | ||
267 | const { data } = await servers[0].commentsCommand.listThreads({ videoId: uuid }) | 267 | const { data } = await servers[0].comments.listThreads({ videoId: uuid }) |
268 | expect(data).to.have.lengthOf(1) | 268 | expect(data).to.have.lengthOf(1) |
269 | 269 | ||
270 | const server1ThreadId = data[0].id | 270 | const server1ThreadId = data[0].id |
271 | await checkCommentMention(baseParams, uuid, server1ThreadId, server1ThreadId, 'super root 2 name', 'presence') | 271 | await checkCommentMention(baseParams, uuid, server1ThreadId, server1ThreadId, 'super root 2 name', 'presence') |
272 | 272 | ||
273 | const text2 = `@user_1@localhost:${servers[0].port} hello 2 @root@localhost:${servers[0].port}` | 273 | const text2 = `@user_1@localhost:${servers[0].port} hello 2 @root@localhost:${servers[0].port}` |
274 | await servers[1].commentsCommand.addReply({ videoId: uuid, toCommentId: server2ThreadId, text: text2 }) | 274 | await servers[1].comments.addReply({ videoId: uuid, toCommentId: server2ThreadId, text: text2 }) |
275 | 275 | ||
276 | await waitJobs(servers) | 276 | await waitJobs(servers) |
277 | 277 | ||
278 | const tree = await servers[0].commentsCommand.getThread({ videoId: uuid, threadId: server1ThreadId }) | 278 | const tree = await servers[0].comments.getThread({ videoId: uuid, threadId: server1ThreadId }) |
279 | 279 | ||
280 | expect(tree.children).to.have.lengthOf(1) | 280 | expect(tree.children).to.have.lengthOf(1) |
281 | const commentId = tree.children[0].comment.id | 281 | const commentId = tree.children[0].comment.id |
@@ -286,11 +286,11 @@ describe('Test comments notifications', function () { | |||
286 | it('Should convert markdown in comment to html', async function () { | 286 | it('Should convert markdown in comment to html', async function () { |
287 | this.timeout(10000) | 287 | this.timeout(10000) |
288 | 288 | ||
289 | const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'super video' } }) | 289 | const { uuid } = await servers[0].videos.upload({ attributes: { name: 'super video' } }) |
290 | 290 | ||
291 | const { id: threadId } = await servers[0].commentsCommand.createThread({ videoId: uuid, text: '@user_1 hello 1' }) | 291 | const { id: threadId } = await servers[0].comments.createThread({ videoId: uuid, text: '@user_1 hello 1' }) |
292 | 292 | ||
293 | await servers[0].commentsCommand.addReply({ videoId: uuid, toCommentId: threadId, text: '@user_1 ' + commentText }) | 293 | await servers[0].comments.addReply({ videoId: uuid, toCommentId: threadId, text: '@user_1 ' + commentText }) |
294 | 294 | ||
295 | await waitJobs(servers) | 295 | await waitJobs(servers) |
296 | 296 | ||