aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/notifications/admin-notifications.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-04-21 15:00:01 +0200
committerChocobozzz <chocobozzz@cpy.re>2023-05-09 08:57:34 +0200
commitd102de1b38f2877463529c3b27bd35ffef4fd8bf (patch)
tree31fa0bdf26ad7a2ee46d600d804a6f03260266c8 /server/tests/api/notifications/admin-notifications.ts
parent2fe978744e5b74eb824e4d79c1bb9b840169f125 (diff)
downloadPeerTube-d102de1b38f2877463529c3b27bd35ffef4fd8bf.tar.gz
PeerTube-d102de1b38f2877463529c3b27bd35ffef4fd8bf.tar.zst
PeerTube-d102de1b38f2877463529c3b27bd35ffef4fd8bf.zip
Add runner server tests
Diffstat (limited to 'server/tests/api/notifications/admin-notifications.ts')
-rw-r--r--server/tests/api/notifications/admin-notifications.ts15
1 files changed, 10 insertions, 5 deletions
diff --git a/server/tests/api/notifications/admin-notifications.ts b/server/tests/api/notifications/admin-notifications.ts
index 6f059f622..4824542c9 100644
--- a/server/tests/api/notifications/admin-notifications.ts
+++ b/server/tests/api/notifications/admin-notifications.ts
@@ -7,7 +7,8 @@ import {
7 checkNewPluginVersion, 7 checkNewPluginVersion,
8 MockJoinPeerTubeVersions, 8 MockJoinPeerTubeVersions,
9 MockSmtpServer, 9 MockSmtpServer,
10 prepareNotificationsTest 10 prepareNotificationsTest,
11 SQLCommand
11} from '@server/tests/shared' 12} from '@server/tests/shared'
12import { wait } from '@shared/core-utils' 13import { wait } from '@shared/core-utils'
13import { PluginType, UserNotification, UserNotificationType } from '@shared/models' 14import { PluginType, UserNotification, UserNotificationType } from '@shared/models'
@@ -15,6 +16,7 @@ import { cleanupTests, PeerTubeServer } from '@shared/server-commands'
15 16
16describe('Test admin notifications', function () { 17describe('Test admin notifications', function () {
17 let server: PeerTubeServer 18 let server: PeerTubeServer
19 let sqlCommand: SQLCommand
18 let userNotifications: UserNotification[] = [] 20 let userNotifications: UserNotification[] = []
19 let adminNotifications: UserNotification[] = [] 21 let adminNotifications: UserNotification[] = []
20 let emails: object[] = [] 22 let emails: object[] = []
@@ -58,6 +60,8 @@ describe('Test admin notifications', function () {
58 60
59 await server.plugins.install({ npmName: 'peertube-plugin-hello-world' }) 61 await server.plugins.install({ npmName: 'peertube-plugin-hello-world' })
60 await server.plugins.install({ npmName: 'peertube-theme-background-red' }) 62 await server.plugins.install({ npmName: 'peertube-theme-background-red' })
63
64 sqlCommand = new SQLCommand(server)
61 }) 65 })
62 66
63 describe('Latest PeerTube version notification', function () { 67 describe('Latest PeerTube version notification', function () {
@@ -116,8 +120,8 @@ describe('Test admin notifications', function () {
116 it('Should send a notification to admins on new plugin version', async function () { 120 it('Should send a notification to admins on new plugin version', async function () {
117 this.timeout(30000) 121 this.timeout(30000)
118 122
119 await server.sql.setPluginVersion('hello-world', '0.0.1') 123 await sqlCommand.setPluginVersion('hello-world', '0.0.1')
120 await server.sql.setPluginLatestVersion('hello-world', '0.0.1') 124 await sqlCommand.setPluginLatestVersion('hello-world', '0.0.1')
121 await wait(6000) 125 await wait(6000)
122 126
123 await checkNewPluginVersion({ ...baseParams, pluginType: PluginType.PLUGIN, pluginName: 'hello-world', checkType: 'presence' }) 127 await checkNewPluginVersion({ ...baseParams, pluginType: PluginType.PLUGIN, pluginName: 'hello-world', checkType: 'presence' })
@@ -138,8 +142,8 @@ describe('Test admin notifications', function () {
138 it('Should send a new notification after a new plugin release', async function () { 142 it('Should send a new notification after a new plugin release', async function () {
139 this.timeout(30000) 143 this.timeout(30000)
140 144
141 await server.sql.setPluginVersion('hello-world', '0.0.1') 145 await sqlCommand.setPluginVersion('hello-world', '0.0.1')
142 await server.sql.setPluginLatestVersion('hello-world', '0.0.1') 146 await sqlCommand.setPluginLatestVersion('hello-world', '0.0.1')
143 await wait(6000) 147 await wait(6000)
144 148
145 expect(adminNotifications.filter(n => n.type === UserNotificationType.NEW_PEERTUBE_VERSION)).to.have.lengthOf(2) 149 expect(adminNotifications.filter(n => n.type === UserNotificationType.NEW_PEERTUBE_VERSION)).to.have.lengthOf(2)
@@ -149,6 +153,7 @@ describe('Test admin notifications', function () {
149 after(async function () { 153 after(async function () {
150 MockSmtpServer.Instance.kill() 154 MockSmtpServer.Instance.kill()
151 155
156 await sqlCommand.cleanup()
152 await cleanupTests([ server ]) 157 await cleanupTests([ server ])
153 }) 158 })
154}) 159})