diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-21 15:51:30 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-21 15:51:30 +0200 |
commit | a24bd1ed41b43790bab6ba789580bb4e85f07d85 (patch) | |
tree | a54b0f6c921ba83a6e909cd0ced325b2d4b8863c /server/tests/api/notifications/admin-notifications.ts | |
parent | 5f26f13b3c16ac5ae0a3b0a7142d84a9528cf565 (diff) | |
parent | c63830f15403ac4e750829f27d8bbbdc9a59282c (diff) | |
download | PeerTube-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.ts | 39 |
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 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { MockJoinPeerTubeVersions } from '@shared/extra-utils/mock-servers/joinpeertube-versions' | ||
6 | import { PluginType } from '@shared/models' | ||
7 | import { cleanupTests, installPlugin, setPluginLatestVersion, setPluginVersion, wait } from '../../../../shared/extra-utils' | ||
8 | import { ServerInfo } from '../../../../shared/extra-utils/index' | ||
9 | import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email' | ||
10 | import { | 5 | import { |
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, |
16 | import { UserNotification, UserNotificationType } from '../../../../shared/models/users' | 11 | MockSmtpServer, |
12 | PeerTubeServer, | ||
13 | prepareNotificationsTest, | ||
14 | wait | ||
15 | } from '@shared/extra-utils' | ||
16 | import { PluginType, UserNotification, UserNotificationType } from '@shared/models' | ||
17 | 17 | ||
18 | describe('Test admin notifications', function () { | 18 | describe('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) |