aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/notifications/admin-notifications.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-21 15:51:30 +0200
committerChocobozzz <me@florianbigard.com>2021-07-21 15:51:30 +0200
commita24bd1ed41b43790bab6ba789580bb4e85f07d85 (patch)
treea54b0f6c921ba83a6e909cd0ced325b2d4b8863c /server/tests/api/notifications/admin-notifications.ts
parent5f26f13b3c16ac5ae0a3b0a7142d84a9528cf565 (diff)
parentc63830f15403ac4e750829f27d8bbbdc9a59282c (diff)
downloadPeerTube-a24bd1ed41b43790bab6ba789580bb4e85f07d85.tar.gz
PeerTube-a24bd1ed41b43790bab6ba789580bb4e85f07d85.tar.zst
PeerTube-a24bd1ed41b43790bab6ba789580bb4e85f07d85.zip
Merge branch 'next' into develop
Diffstat (limited to 'server/tests/api/notifications/admin-notifications.ts')
-rw-r--r--server/tests/api/notifications/admin-notifications.ts39
1 files changed, 15 insertions, 24 deletions
diff --git a/server/tests/api/notifications/admin-notifications.ts b/server/tests/api/notifications/admin-notifications.ts
index cfe0bd2bb..b36ba11a9 100644
--- a/server/tests/api/notifications/admin-notifications.ts
+++ b/server/tests/api/notifications/admin-notifications.ts
@@ -2,21 +2,21 @@
2 2
3import 'mocha' 3import 'mocha'
4import { expect } from 'chai' 4import { expect } from 'chai'
5import { MockJoinPeerTubeVersions } from '@shared/extra-utils/mock-servers/joinpeertube-versions'
6import { PluginType } from '@shared/models'
7import { cleanupTests, installPlugin, setPluginLatestVersion, setPluginVersion, wait } from '../../../../shared/extra-utils'
8import { ServerInfo } from '../../../../shared/extra-utils/index'
9import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email'
10import { 5import {
11 CheckerBaseParams, 6 CheckerBaseParams,
12 checkNewPeerTubeVersion, 7 checkNewPeerTubeVersion,
13 checkNewPluginVersion, 8 checkNewPluginVersion,
14 prepareNotificationsTest 9 cleanupTests,
15} from '../../../../shared/extra-utils/users/user-notifications' 10 MockJoinPeerTubeVersions,
16import { UserNotification, UserNotificationType } from '../../../../shared/models/users' 11 MockSmtpServer,
12 PeerTubeServer,
13 prepareNotificationsTest,
14 wait
15} from '@shared/extra-utils'
16import { PluginType, UserNotification, UserNotificationType } from '@shared/models'
17 17
18describe('Test admin notifications', function () { 18describe('Test admin notifications', function () {
19 let server: ServerInfo 19 let server: PeerTubeServer
20 let userNotifications: UserNotification[] = [] 20 let userNotifications: UserNotification[] = []
21 let adminNotifications: UserNotification[] = [] 21 let adminNotifications: UserNotification[] = []
22 let emails: object[] = [] 22 let emails: object[] = []
@@ -58,17 +58,8 @@ describe('Test admin notifications', function () {
58 token: server.accessToken 58 token: server.accessToken
59 } 59 }
60 60
61 await installPlugin({ 61 await server.plugins.install({ npmName: 'peertube-plugin-hello-world' })
62 url: server.url, 62 await server.plugins.install({ npmName: 'peertube-theme-background-red' })
63 accessToken: server.accessToken,
64 npmName: 'peertube-plugin-hello-world'
65 })
66
67 await installPlugin({
68 url: server.url,
69 accessToken: server.accessToken,
70 npmName: 'peertube-theme-background-red'
71 })
72 }) 63 })
73 64
74 describe('Latest PeerTube version notification', function () { 65 describe('Latest PeerTube version notification', function () {
@@ -127,8 +118,8 @@ describe('Test admin notifications', function () {
127 it('Should send a notification to admins on new plugin version', async function () { 118 it('Should send a notification to admins on new plugin version', async function () {
128 this.timeout(30000) 119 this.timeout(30000)
129 120
130 await setPluginVersion(server.internalServerNumber, 'hello-world', '0.0.1') 121 await server.sql.setPluginVersion('hello-world', '0.0.1')
131 await setPluginLatestVersion(server.internalServerNumber, 'hello-world', '0.0.1') 122 await server.sql.setPluginLatestVersion('hello-world', '0.0.1')
132 await wait(6000) 123 await wait(6000)
133 124
134 await checkNewPluginVersion(baseParams, PluginType.PLUGIN, 'hello-world', 'presence') 125 await checkNewPluginVersion(baseParams, PluginType.PLUGIN, 'hello-world', 'presence')
@@ -149,8 +140,8 @@ describe('Test admin notifications', function () {
149 it('Should send a new notification after a new plugin release', async function () { 140 it('Should send a new notification after a new plugin release', async function () {
150 this.timeout(30000) 141 this.timeout(30000)
151 142
152 await setPluginVersion(server.internalServerNumber, 'hello-world', '0.0.1') 143 await server.sql.setPluginVersion('hello-world', '0.0.1')
153 await setPluginLatestVersion(server.internalServerNumber, 'hello-world', '0.0.1') 144 await server.sql.setPluginLatestVersion('hello-world', '0.0.1')
154 await wait(6000) 145 await wait(6000)
155 146
156 expect(adminNotifications.filter(n => n.type === UserNotificationType.NEW_PEERTUBE_VERSION)).to.have.lengthOf(2) 147 expect(adminNotifications.filter(n => n.type === UserNotificationType.NEW_PEERTUBE_VERSION)).to.have.lengthOf(2)