diff options
author | Chocobozzz <me@florianbigard.com> | 2022-03-22 14:35:04 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-03-22 16:25:14 +0100 |
commit | 1808a1f8e4b7b102823492a2007a46929aebf189 (patch) | |
tree | a345140ec9a7a20c222ace3cda18ac999277c8c3 /server/tests/shared/notifications.ts | |
parent | 348c2ce3ff3fe2f25a31f08bfb36c88723a0ce46 (diff) | |
download | PeerTube-1808a1f8e4b7b102823492a2007a46929aebf189.tar.gz PeerTube-1808a1f8e4b7b102823492a2007a46929aebf189.tar.zst PeerTube-1808a1f8e4b7b102823492a2007a46929aebf189.zip |
Add video edition finished notification
Diffstat (limited to 'server/tests/shared/notifications.ts')
-rw-r--r-- | server/tests/shared/notifications.ts | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/server/tests/shared/notifications.ts b/server/tests/shared/notifications.ts index 78d3787f0..f1ddbbbf7 100644 --- a/server/tests/shared/notifications.ts +++ b/server/tests/shared/notifications.ts | |||
@@ -47,6 +47,7 @@ function getAllNotificationsSettings (): UserNotificationSetting { | |||
47 | abuseStateChange: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, | 47 | abuseStateChange: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, |
48 | autoInstanceFollowing: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, | 48 | autoInstanceFollowing: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, |
49 | newPeerTubeVersion: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, | 49 | newPeerTubeVersion: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, |
50 | myVideoEditionFinished: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, | ||
50 | newPluginVersion: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL | 51 | newPluginVersion: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL |
51 | } | 52 | } |
52 | } | 53 | } |
@@ -109,6 +110,34 @@ async function checkVideoIsPublished (options: CheckerBaseParams & { | |||
109 | await checkNotification({ ...options, notificationChecker, emailNotificationFinder }) | 110 | await checkNotification({ ...options, notificationChecker, emailNotificationFinder }) |
110 | } | 111 | } |
111 | 112 | ||
113 | async function checkVideoEditionIsFinished (options: CheckerBaseParams & { | ||
114 | videoName: string | ||
115 | shortUUID: string | ||
116 | checkType: CheckerType | ||
117 | }) { | ||
118 | const { videoName, shortUUID } = options | ||
119 | const notificationType = UserNotificationType.MY_VIDEO_EDITION_FINISHED | ||
120 | |||
121 | function notificationChecker (notification: UserNotification, checkType: CheckerType) { | ||
122 | if (checkType === 'presence') { | ||
123 | expect(notification).to.not.be.undefined | ||
124 | expect(notification.type).to.equal(notificationType) | ||
125 | |||
126 | checkVideo(notification.video, videoName, shortUUID) | ||
127 | checkActor(notification.video.channel) | ||
128 | } else { | ||
129 | expect(notification.video).to.satisfy(v => v === undefined || v.name !== videoName) | ||
130 | } | ||
131 | } | ||
132 | |||
133 | function emailNotificationFinder (email: object) { | ||
134 | const text: string = email['text'] | ||
135 | return text.includes(shortUUID) && text.includes('Edition of your video') | ||
136 | } | ||
137 | |||
138 | await checkNotification({ ...options, notificationChecker, emailNotificationFinder }) | ||
139 | } | ||
140 | |||
112 | async function checkMyVideoImportIsFinished (options: CheckerBaseParams & { | 141 | async function checkMyVideoImportIsFinished (options: CheckerBaseParams & { |
113 | videoName: string | 142 | videoName: string |
114 | shortUUID: string | 143 | shortUUID: string |
@@ -656,6 +685,8 @@ async function prepareNotificationsTest (serversCount = 3, overrideConfigArg: an | |||
656 | await setDefaultChannelAvatar(servers) | 685 | await setDefaultChannelAvatar(servers) |
657 | await setDefaultAccountAvatar(servers) | 686 | await setDefaultAccountAvatar(servers) |
658 | 687 | ||
688 | await servers[1].config.enableEditor() | ||
689 | |||
659 | if (serversCount > 1) { | 690 | if (serversCount > 1) { |
660 | await doubleFollow(servers[0], servers[1]) | 691 | await doubleFollow(servers[0], servers[1]) |
661 | } | 692 | } |
@@ -724,7 +755,8 @@ export { | |||
724 | checkNewCommentAbuseForModerators, | 755 | checkNewCommentAbuseForModerators, |
725 | checkNewAccountAbuseForModerators, | 756 | checkNewAccountAbuseForModerators, |
726 | checkNewPeerTubeVersion, | 757 | checkNewPeerTubeVersion, |
727 | checkNewPluginVersion | 758 | checkNewPluginVersion, |
759 | checkVideoEditionIsFinished | ||
728 | } | 760 | } |
729 | 761 | ||
730 | // --------------------------------------------------------------------------- | 762 | // --------------------------------------------------------------------------- |