aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-05-25 09:10:20 +0200
committerChocobozzz <me@florianbigard.com>2022-05-25 09:37:30 +0200
commita220b84b0e29c7ce1b32166aec07870696a28ef9 (patch)
treec7dfdbe24a28e5491d6dc103ffc9b10d4f15296a /server/tests/shared
parent424aeb12bd16f5d6763dfa2860d113cc93876405 (diff)
downloadPeerTube-a220b84b0e29c7ce1b32166aec07870696a28ef9.tar.gz
PeerTube-a220b84b0e29c7ce1b32166aec07870696a28ef9.tar.zst
PeerTube-a220b84b0e29c7ce1b32166aec07870696a28ef9.zip
Fix avatars in notifications
Diffstat (limited to 'server/tests/shared')
-rw-r--r--server/tests/shared/notifications.ts20
1 files changed, 16 insertions, 4 deletions
diff --git a/server/tests/shared/notifications.ts b/server/tests/shared/notifications.ts
index a62410880..09bc8da03 100644
--- a/server/tests/shared/notifications.ts
+++ b/server/tests/shared/notifications.ts
@@ -185,7 +185,7 @@ async function checkUserRegistered (options: CheckerBaseParams & {
185 expect(notification).to.not.be.undefined 185 expect(notification).to.not.be.undefined
186 expect(notification.type).to.equal(notificationType) 186 expect(notification.type).to.equal(notificationType)
187 187
188 checkActor(notification.account) 188 checkActor(notification.account, { withAvatar: false })
189 expect(notification.account.name).to.equal(username) 189 expect(notification.account.name).to.equal(username)
190 } else { 190 } else {
191 expect(notification).to.satisfy(n => n.type !== notificationType || n.account.name !== username) 191 expect(notification).to.satisfy(n => n.type !== notificationType || n.account.name !== username)
@@ -253,7 +253,7 @@ async function checkNewInstanceFollower (options: CheckerBaseParams & {
253 expect(notification).to.not.be.undefined 253 expect(notification).to.not.be.undefined
254 expect(notification.type).to.equal(notificationType) 254 expect(notification.type).to.equal(notificationType)
255 255
256 checkActor(notification.actorFollow.follower) 256 checkActor(notification.actorFollow.follower, { withAvatar: false })
257 expect(notification.actorFollow.follower.name).to.equal('peertube') 257 expect(notification.actorFollow.follower.name).to.equal('peertube')
258 expect(notification.actorFollow.follower.host).to.equal(followerHost) 258 expect(notification.actorFollow.follower.host).to.equal(followerHost)
259 259
@@ -288,7 +288,8 @@ async function checkAutoInstanceFollowing (options: CheckerBaseParams & {
288 expect(notification.type).to.equal(notificationType) 288 expect(notification.type).to.equal(notificationType)
289 289
290 const following = notification.actorFollow.following 290 const following = notification.actorFollow.following
291 checkActor(following) 291
292 checkActor(following, { withAvatar: false })
292 expect(following.name).to.equal('peertube') 293 expect(following.name).to.equal('peertube')
293 expect(following.host).to.equal(followingHost) 294 expect(following.host).to.equal(followingHost)
294 295
@@ -701,6 +702,9 @@ async function prepareNotificationsTest (serversCount = 3, overrideConfigArg: an
701 const userAccessToken = await servers[0].login.getAccessToken(user) 702 const userAccessToken = await servers[0].login.getAccessToken(user)
702 703
703 await servers[0].notifications.updateMySettings({ token: userAccessToken, settings: getAllNotificationsSettings() }) 704 await servers[0].notifications.updateMySettings({ token: userAccessToken, settings: getAllNotificationsSettings() })
705 await servers[0].users.updateMyAvatar({ token: userAccessToken, fixture: 'avatar.png' })
706 await servers[0].channels.updateImage({ channelName: 'user_1_channel', token: userAccessToken, fixture: 'avatar.png', type: 'avatar' })
707
704 await servers[0].notifications.updateMySettings({ settings: getAllNotificationsSettings() }) 708 await servers[0].notifications.updateMySettings({ settings: getAllNotificationsSettings() })
705 709
706 if (serversCount > 1) { 710 if (serversCount > 1) {
@@ -832,10 +836,18 @@ function checkVideo (video: any, videoName?: string, shortUUID?: string) {
832 expect(video.id).to.be.a('number') 836 expect(video.id).to.be.a('number')
833} 837}
834 838
835function checkActor (actor: any) { 839function checkActor (actor: any, options: { withAvatar?: boolean } = {}) {
840 const { withAvatar = true } = options
841
836 expect(actor.displayName).to.be.a('string') 842 expect(actor.displayName).to.be.a('string')
837 expect(actor.displayName).to.not.be.empty 843 expect(actor.displayName).to.not.be.empty
838 expect(actor.host).to.not.be.undefined 844 expect(actor.host).to.not.be.undefined
845
846 if (withAvatar) {
847 expect(actor.avatars).to.be.an('array')
848 expect(actor.avatars).to.have.lengthOf(2)
849 expect(actor.avatars[0].path).to.exist.and.not.empty
850 }
839} 851}
840 852
841function checkComment (comment: any, commentId: number, threadId: number) { 853function checkComment (comment: any, commentId: number, threadId: number) {