X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fnotifications%2Fadmin-notifications.ts;h=18962a71e77363f4ce4d155a20352907fcff4ab9;hb=bf54587a3e2ad9c2c186828f2a5682b91ee2cc00;hp=03fbe0b700c5e3e9e2d66e080fa920970677c0b7;hpb=9293139fde7091e9badcafa9b570b83cea9a10ad;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/notifications/admin-notifications.ts b/server/tests/api/notifications/admin-notifications.ts index 03fbe0b70..18962a71e 100644 --- a/server/tests/api/notifications/admin-notifications.ts +++ b/server/tests/api/notifications/admin-notifications.ts @@ -9,14 +9,14 @@ import { cleanupTests, MockJoinPeerTubeVersions, MockSmtpServer, + PeerTubeServer, prepareNotificationsTest, - ServerInfo, wait -} from '@shared/extra-utils' +} from '@shared/server-commands' import { PluginType, UserNotification, UserNotificationType } from '@shared/models' describe('Test admin notifications', function () { - let server: ServerInfo + let server: PeerTubeServer let userNotifications: UserNotification[] = [] let adminNotifications: UserNotification[] = [] let emails: object[] = [] @@ -58,8 +58,8 @@ describe('Test admin notifications', function () { token: server.accessToken } - await server.pluginsCommand.install({ npmName: 'peertube-plugin-hello-world' }) - await server.pluginsCommand.install({ npmName: 'peertube-theme-background-red' }) + await server.plugins.install({ npmName: 'peertube-plugin-hello-world' }) + await server.plugins.install({ npmName: 'peertube-theme-background-red' }) }) describe('Latest PeerTube version notification', function () { @@ -70,7 +70,7 @@ describe('Test admin notifications', function () { joinPeerTubeServer.setLatestVersion('1.4.2') await wait(3000) - await checkNewPeerTubeVersion(baseParams, '1.4.2', 'absence') + await checkNewPeerTubeVersion({ ...baseParams, latestVersion: '1.4.2', checkType: 'absence' }) }) it('Should send a notification to admins on new plugin version', async function () { @@ -79,7 +79,7 @@ describe('Test admin notifications', function () { joinPeerTubeServer.setLatestVersion('15.4.2') await wait(3000) - await checkNewPeerTubeVersion(baseParams, '15.4.2', 'presence') + await checkNewPeerTubeVersion({ ...baseParams, latestVersion: '15.4.2', checkType: 'presence' }) }) it('Should not send the same notification to admins', async function () { @@ -101,7 +101,7 @@ describe('Test admin notifications', function () { joinPeerTubeServer.setLatestVersion('15.4.3') await wait(3000) - await checkNewPeerTubeVersion(baseParams, '15.4.3', 'presence') + await checkNewPeerTubeVersion({ ...baseParams, latestVersion: '15.4.3', checkType: 'presence' }) expect(adminNotifications.filter(n => n.type === UserNotificationType.NEW_PEERTUBE_VERSION)).to.have.lengthOf(2) }) }) @@ -112,17 +112,17 @@ describe('Test admin notifications', function () { this.timeout(30000) await wait(6000) - await checkNewPluginVersion(baseParams, PluginType.PLUGIN, 'hello-world', 'absence') + await checkNewPluginVersion({ ...baseParams, pluginType: PluginType.PLUGIN, pluginName: 'hello-world', checkType: 'absence' }) }) it('Should send a notification to admins on new plugin version', async function () { this.timeout(30000) - await server.sqlCommand.setPluginVersion('hello-world', '0.0.1') - await server.sqlCommand.setPluginLatestVersion('hello-world', '0.0.1') + await server.sql.setPluginVersion('hello-world', '0.0.1') + await server.sql.setPluginLatestVersion('hello-world', '0.0.1') await wait(6000) - await checkNewPluginVersion(baseParams, PluginType.PLUGIN, 'hello-world', 'presence') + await checkNewPluginVersion({ ...baseParams, pluginType: PluginType.PLUGIN, pluginName: 'hello-world', checkType: 'presence' }) }) it('Should not send the same notification to admins', async function () { @@ -140,8 +140,8 @@ describe('Test admin notifications', function () { it('Should send a new notification after a new plugin release', async function () { this.timeout(30000) - await server.sqlCommand.setPluginVersion('hello-world', '0.0.1') - await server.sqlCommand.setPluginLatestVersion('hello-world', '0.0.1') + await server.sql.setPluginVersion('hello-world', '0.0.1') + await server.sql.setPluginLatestVersion('hello-world', '0.0.1') await wait(6000) expect(adminNotifications.filter(n => n.type === UserNotificationType.NEW_PEERTUBE_VERSION)).to.have.lengthOf(2)