]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/notifications/user-notifications.ts
Add signup approval API REST doc
[github/Chocobozzz/PeerTube.git] / server / tests / api / notifications / user-notifications.ts
index a11289236934ac0512e7290e2c0a161f89bb719c..f945cb6a8aec040c53ce5569cf7c01c505f6234f 100644 (file)
@@ -1,7 +1,6 @@
 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
-import 'mocha'
-import * as chai from 'chai'
+import { expect } from 'chai'
 import {
   CheckerBaseParams,
   checkMyVideoImportIsFinished,
@@ -19,8 +18,6 @@ import { buildUUID } from '@shared/extra-utils'
 import { UserNotification, UserNotificationType, VideoPrivacy, VideoStudioTask } from '@shared/models'
 import { cleanupTests, findExternalSavedVideo, PeerTubeServer, stopFfmpeg, waitJobs } from '@shared/server-commands'
 
-const expect = chai.expect
-
 describe('Test user notifications', function () {
   let servers: PeerTubeServer[] = []
   let userAccessToken: string
@@ -72,7 +69,7 @@ describe('Test user notifications', function () {
     it('Should send a new video notification if the user follows the local video publisher', async function () {
       this.timeout(15000)
 
-      await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'root_channel@localhost:' + servers[0].port })
+      await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'root_channel@' + servers[0].host })
       await waitJobs(servers)
 
       const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 1)
@@ -82,7 +79,7 @@ describe('Test user notifications', function () {
     it('Should send a new video notification from a remote account', async function () {
       this.timeout(150000) // Server 2 has transcoding enabled
 
-      await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'root_channel@localhost:' + servers[1].port })
+      await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'root_channel@' + servers[1].host })
       await waitJobs(servers)
 
       const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 2)
@@ -161,7 +158,7 @@ describe('Test user notifications', function () {
     })
 
     it('Should send a new video notification when a remote video becomes public', async function () {
-      this.timeout(50000)
+      this.timeout(120000)
 
       const data = { privacy: VideoPrivacy.PRIVATE }
       const { name, uuid, shortUUID } = await uploadRandomVideoOnServers(servers, 2, data)
@@ -250,7 +247,7 @@ describe('Test user notifications', function () {
     })
 
     it('Should send a notification even if the video is not transcoded in other resolutions', async function () {
-      this.timeout(50000)
+      this.timeout(100_000)
 
       const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 2, { waitTranscoding: true, fixture: 'video_short_240p.mp4' })
       await waitJobs(servers)
@@ -259,7 +256,7 @@ describe('Test user notifications', function () {
     })
 
     it('Should send a notification with a transcoded video', async function () {
-      this.timeout(50000)
+      this.timeout(100_000)
 
       const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 2, { waitTranscoding: true })
       await waitJobs(servers)
@@ -305,7 +302,7 @@ describe('Test user notifications', function () {
     })
 
     it('Should not send a notification before the video is published', async function () {
-      this.timeout(50000)
+      this.timeout(150000)
 
       const updateAt = new Date(new Date().getTime() + 1000000)
 
@@ -512,7 +509,7 @@ describe('Test user notifications', function () {
     it('Should notify when a local channel is following one of our channel', async function () {
       this.timeout(50000)
 
-      await servers[0].subscriptions.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port })
+      await servers[0].subscriptions.add({ targetUri: 'user_1_channel@' + servers[0].host })
       await waitJobs(servers)
 
       await checkNewActorFollow({
@@ -524,13 +521,13 @@ describe('Test user notifications', function () {
         checkType: 'presence'
       })
 
-      await servers[0].subscriptions.remove({ uri: 'user_1_channel@localhost:' + servers[0].port })
+      await servers[0].subscriptions.remove({ uri: 'user_1_channel@' + servers[0].host })
     })
 
     it('Should notify when a remote channel is following one of our channel', async function () {
       this.timeout(50000)
 
-      await servers[1].subscriptions.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port })
+      await servers[1].subscriptions.add({ targetUri: 'user_1_channel@' + servers[0].host })
       await waitJobs(servers)
 
       await checkNewActorFollow({
@@ -542,14 +539,14 @@ describe('Test user notifications', function () {
         checkType: 'presence'
       })
 
-      await servers[1].subscriptions.remove({ uri: 'user_1_channel@localhost:' + servers[0].port })
+      await servers[1].subscriptions.remove({ uri: 'user_1_channel@' + servers[0].host })
     })
 
     // PeerTube does not support account -> account follows
     // it('Should notify when a local account is following one of our channel', async function () {
     //   this.timeout(50000)
     //
-    //   await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1@localhost:' + servers[0].port)
+    //   await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1@' + servers[0].host)
     //
     //   await waitJobs(servers)
     //
@@ -559,7 +556,7 @@ describe('Test user notifications', function () {
     // it('Should notify when a remote account is following one of our channel', async function () {
     //   this.timeout(50000)
     //
-    //   await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1@localhost:' + servers[0].port)
+    //   await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1@' + servers[0].host)
     //
     //   await waitJobs(servers)
     //