aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/check-params/user-notifications.ts3
-rw-r--r--server/tests/api/index-1.ts1
-rw-r--r--server/tests/api/notifications/index.ts1
-rw-r--r--server/tests/api/notifications/user-notifications.ts (renamed from server/tests/api/users/user-notifications.ts)35
-rw-r--r--server/tests/api/users/index.ts1
5 files changed, 35 insertions, 6 deletions
diff --git a/server/tests/api/check-params/user-notifications.ts b/server/tests/api/check-params/user-notifications.ts
index 36eaceac7..4b75f6920 100644
--- a/server/tests/api/check-params/user-notifications.ts
+++ b/server/tests/api/check-params/user-notifications.ts
@@ -174,7 +174,8 @@ describe('Test user notifications API validators', function () {
174 myVideoPublished: UserNotificationSettingValue.WEB, 174 myVideoPublished: UserNotificationSettingValue.WEB,
175 commentMention: UserNotificationSettingValue.WEB, 175 commentMention: UserNotificationSettingValue.WEB,
176 newFollow: UserNotificationSettingValue.WEB, 176 newFollow: UserNotificationSettingValue.WEB,
177 newUserRegistration: UserNotificationSettingValue.WEB 177 newUserRegistration: UserNotificationSettingValue.WEB,
178 newInstanceFollower: UserNotificationSettingValue.WEB
178 } 179 }
179 180
180 it('Should fail with missing fields', async function () { 181 it('Should fail with missing fields', async function () {
diff --git a/server/tests/api/index-1.ts b/server/tests/api/index-1.ts
index 80d752f42..75cdd9025 100644
--- a/server/tests/api/index-1.ts
+++ b/server/tests/api/index-1.ts
@@ -1,2 +1,3 @@
1import './check-params' 1import './check-params'
2import './notifications'
2import './search' 3import './search'
diff --git a/server/tests/api/notifications/index.ts b/server/tests/api/notifications/index.ts
new file mode 100644
index 000000000..95ac8fc51
--- /dev/null
+++ b/server/tests/api/notifications/index.ts
@@ -0,0 +1 @@
export * from './user-notifications'
diff --git a/server/tests/api/users/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts
index ac47978e2..7bff52796 100644
--- a/server/tests/api/users/user-notifications.ts
+++ b/server/tests/api/notifications/user-notifications.ts
@@ -19,7 +19,7 @@ import {
19 userLogin, 19 userLogin,
20 wait, 20 wait,
21 getCustomConfig, 21 getCustomConfig,
22 updateCustomConfig, getVideoThreadComments, getVideoCommentThreads 22 updateCustomConfig, getVideoThreadComments, getVideoCommentThreads, follow
23} from '../../../../shared/utils' 23} from '../../../../shared/utils'
24import { killallServers, ServerInfo, uploadVideo } from '../../../../shared/utils/index' 24import { killallServers, ServerInfo, uploadVideo } from '../../../../shared/utils/index'
25import { setAccessTokensToServers } from '../../../../shared/utils/users/login' 25import { setAccessTokensToServers } from '../../../../shared/utils/users/login'
@@ -41,7 +41,7 @@ import {
41 getUserNotifications, 41 getUserNotifications,
42 markAsReadNotifications, 42 markAsReadNotifications,
43 updateMyNotificationSettings, 43 updateMyNotificationSettings,
44 markAsReadAllNotifications 44 markAsReadAllNotifications, checkNewInstanceFollower
45} from '../../../../shared/utils/users/user-notifications' 45} from '../../../../shared/utils/users/user-notifications'
46import { 46import {
47 User, 47 User,
@@ -103,7 +103,8 @@ describe('Test users notifications', function () {
103 myVideoPublished: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, 103 myVideoPublished: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
104 commentMention: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, 104 commentMention: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
105 newFollow: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, 105 newFollow: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
106 newUserRegistration: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL 106 newUserRegistration: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
107 newInstanceFollower: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL
107 } 108 }
108 109
109 before(async function () { 110 before(async function () {
@@ -118,7 +119,7 @@ describe('Test users notifications', function () {
118 hostname: 'localhost' 119 hostname: 'localhost'
119 } 120 }
120 } 121 }
121 servers = await flushAndRunMultipleServers(2, overrideConfig) 122 servers = await flushAndRunMultipleServers(3, overrideConfig)
122 123
123 // Get the access tokens 124 // Get the access tokens
124 await setAccessTokensToServers(servers) 125 await setAccessTokensToServers(servers)
@@ -861,6 +862,32 @@ describe('Test users notifications', function () {
861 }) 862 })
862 }) 863 })
863 864
865 describe('New instance follower', function () {
866 let baseParams: CheckerBaseParams
867
868 before(async () => {
869 baseParams = {
870 server: servers[0],
871 emails,
872 socketNotifications: adminNotifications,
873 token: servers[0].accessToken
874 }
875 })
876
877 it('Should send a notification only to admin when there is a new instance follower', async function () {
878 this.timeout(10000)
879
880 await follow(servers[2].url, [ servers[0].url ], servers[2].accessToken)
881
882 await waitJobs(servers)
883
884 await checkNewInstanceFollower(baseParams, 'localhost:9003', 'presence')
885
886 const userOverride = { socketNotifications: userNotifications, token: userAccessToken, check: { web: true, mail: false } }
887 await checkNewInstanceFollower(immutableAssign(baseParams, userOverride), 'localhost:9003', 'absence')
888 })
889 })
890
864 describe('New actor follow', function () { 891 describe('New actor follow', function () {
865 let baseParams: CheckerBaseParams 892 let baseParams: CheckerBaseParams
866 let myChannelName = 'super channel name' 893 let myChannelName = 'super channel name'
diff --git a/server/tests/api/users/index.ts b/server/tests/api/users/index.ts
index 52ba6984e..fcd022429 100644
--- a/server/tests/api/users/index.ts
+++ b/server/tests/api/users/index.ts
@@ -1,5 +1,4 @@
1import './users-verification' 1import './users-verification'
2import './user-notifications'
3import './blocklist' 2import './blocklist'
4import './user-subscriptions' 3import './user-subscriptions'
5import './users' 4import './users'