aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/notifications
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/notifications')
-rw-r--r--server/tests/api/notifications/user-notifications.ts40
1 files changed, 36 insertions, 4 deletions
diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts
index 6fa630562..62b797b47 100644
--- a/server/tests/api/notifications/user-notifications.ts
+++ b/server/tests/api/notifications/user-notifications.ts
@@ -16,8 +16,8 @@ import {
16 immutableAssign, 16 immutableAssign,
17 registerUser, 17 registerUser,
18 removeVideoFromBlacklist, 18 removeVideoFromBlacklist,
19 reportVideoAbuse, 19 reportVideoAbuse, unfollow,
20 updateCustomConfig, 20 updateCustomConfig, updateCustomSubConfig,
21 updateMyUser, 21 updateMyUser,
22 updateVideo, 22 updateVideo,
23 updateVideoChannel, 23 updateVideoChannel,
@@ -45,7 +45,8 @@ import {
45 getUserNotifications, 45 getUserNotifications,
46 markAsReadAllNotifications, 46 markAsReadAllNotifications,
47 markAsReadNotifications, 47 markAsReadNotifications,
48 updateMyNotificationSettings 48 updateMyNotificationSettings,
49 checkAutoInstanceFollowing
49} from '../../../../shared/extra-utils/users/user-notifications' 50} from '../../../../shared/extra-utils/users/user-notifications'
50import { 51import {
51 User, 52 User,
@@ -108,7 +109,8 @@ describe('Test users notifications', function () {
108 commentMention: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, 109 commentMention: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
109 newFollow: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, 110 newFollow: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
110 newUserRegistration: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, 111 newUserRegistration: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
111 newInstanceFollower: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL 112 newInstanceFollower: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
113 autoInstanceFollowing: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL
112 } 114 }
113 115
114 before(async function () { 116 before(async function () {
@@ -897,6 +899,36 @@ describe('Test users notifications', function () {
897 const userOverride = { socketNotifications: userNotifications, token: userAccessToken, check: { web: true, mail: false } } 899 const userOverride = { socketNotifications: userNotifications, token: userAccessToken, check: { web: true, mail: false } }
898 await checkNewInstanceFollower(immutableAssign(baseParams, userOverride), 'localhost:' + servers[2].port, 'absence') 900 await checkNewInstanceFollower(immutableAssign(baseParams, userOverride), 'localhost:' + servers[2].port, 'absence')
899 }) 901 })
902
903 it('Should send a notification on auto follow back', async function () {
904 this.timeout(40000)
905
906 await unfollow(servers[2].url, servers[2].accessToken, servers[0])
907 await waitJobs(servers)
908
909 const config = {
910 followings: {
911 instance: {
912 autoFollowBack: { enabled: true }
913 }
914 }
915 }
916 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config)
917
918 await follow(servers[2].url, [ servers[0].url ], servers[2].accessToken)
919
920 await waitJobs(servers)
921
922 const followerHost = servers[0].host
923 const followingHost = servers[2].host
924 await checkAutoInstanceFollowing(baseParams, followerHost, followingHost, 'presence')
925
926 const userOverride = { socketNotifications: userNotifications, token: userAccessToken, check: { web: true, mail: false } }
927 await checkAutoInstanceFollowing(immutableAssign(baseParams, userOverride), followerHost, followingHost, 'absence')
928
929 config.followings.instance.autoFollowBack.enabled = false
930 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config)
931 })
900 }) 932 })
901 933
902 describe('New actor follow', function () { 934 describe('New actor follow', function () {