]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/server/config.ts
First implem global search
[github/Chocobozzz/PeerTube.git] / server / tests / api / server / config.ts
index 97cc99eeaf892494bc22a8d8ab22ef7b4d9a16aa..59723358865182a10ea3cbc528ee3289f50d26ce 100644 (file)
@@ -1,4 +1,4 @@
-/* tslint:disable:no-unused-expression */
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import 'mocha'
 import * as chai from 'chai'
@@ -11,11 +11,14 @@ import {
   getAbout,
   getConfig,
   getCustomConfig,
-  killallServers, parallelTests,
+  killallServers,
+  parallelTests,
   registerUser,
-  reRunServer, ServerInfo,
+  reRunServer,
+  ServerInfo,
   setAccessTokensToServers,
-  updateCustomConfig, uploadVideo
+  updateCustomConfig,
+  uploadVideo
 } from '../../../../shared/extra-utils'
 import { ServerConfig } from '../../../../shared/models'
 
@@ -24,8 +27,7 @@ const expect = chai.expect
 function checkInitialConfig (server: ServerInfo, data: CustomConfig) {
   expect(data.instance.name).to.equal('PeerTube')
   expect(data.instance.shortDescription).to.equal(
-    'PeerTube, a federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser ' +
-    'with WebTorrent and Angular.'
+    'PeerTube, an ActivityPub-federated video streaming platform using P2P directly in your web browser.'
   )
   expect(data.instance.description).to.equal('Welcome to this PeerTube instance!')
 
@@ -72,6 +74,7 @@ function checkInitialConfig (server: ServerInfo, data: CustomConfig) {
   expect(data.transcoding.resolutions['720p']).to.be.true
   expect(data.transcoding.resolutions['1080p']).to.be.true
   expect(data.transcoding.resolutions['2160p']).to.be.true
+  expect(data.transcoding.webtorrent.enabled).to.be.true
   expect(data.transcoding.hls.enabled).to.be.true
 
   expect(data.import.videos.http.enabled).to.be.true
@@ -83,7 +86,12 @@ function checkInitialConfig (server: ServerInfo, data: CustomConfig) {
 
   expect(data.followings.instance.autoFollowBack.enabled).to.be.false
   expect(data.followings.instance.autoFollowIndex.enabled).to.be.false
-  expect(data.followings.instance.autoFollowIndex.indexUrl).to.equal('https://instances.joinpeertube.org')
+  expect(data.followings.instance.autoFollowIndex.indexUrl).to.equal('')
+
+  expect(data.broadcastMessage.enabled).to.be.false
+  expect(data.broadcastMessage.level).to.equal('info')
+  expect(data.broadcastMessage.message).to.equal('')
+  expect(data.broadcastMessage.dismissable).to.be.false
 }
 
 function checkUpdatedConfig (data: CustomConfig) {
@@ -140,6 +148,7 @@ function checkUpdatedConfig (data: CustomConfig) {
   expect(data.transcoding.resolutions['1080p']).to.be.false
   expect(data.transcoding.resolutions['2160p']).to.be.false
   expect(data.transcoding.hls.enabled).to.be.false
+  expect(data.transcoding.webtorrent.enabled).to.be.true
 
   expect(data.import.videos.http.enabled).to.be.false
   expect(data.import.videos.torrent.enabled).to.be.false
@@ -151,6 +160,11 @@ function checkUpdatedConfig (data: CustomConfig) {
   expect(data.followings.instance.autoFollowBack.enabled).to.be.true
   expect(data.followings.instance.autoFollowIndex.enabled).to.be.true
   expect(data.followings.instance.autoFollowIndex.indexUrl).to.equal('https://updated.example.com')
+
+  expect(data.broadcastMessage.enabled).to.be.true
+  expect(data.broadcastMessage.level).to.equal('error')
+  expect(data.broadcastMessage.message).to.equal('super bad message')
+  expect(data.broadcastMessage.dismissable).to.be.true
 }
 
 describe('Test config', function () {
@@ -272,6 +286,7 @@ describe('Test config', function () {
         allowAudioFiles: true,
         threads: 1,
         resolutions: {
+          '0p': false,
           '240p': false,
           '360p': true,
           '480p': true,
@@ -279,6 +294,9 @@ describe('Test config', function () {
           '1080p': false,
           '2160p': false
         },
+        webtorrent: {
+          enabled: true
+        },
         hls: {
           enabled: false
         }
@@ -316,6 +334,24 @@ describe('Test config', function () {
             indexUrl: 'https://updated.example.com'
           }
         }
+      },
+      broadcastMessage: {
+        enabled: true,
+        level: 'error',
+        message: 'super bad message',
+        dismissable: true
+      },
+      search: {
+        remoteUri: {
+          anonymous: true,
+          users: true
+        },
+        searchIndex: {
+          enabled: true,
+          url: 'https://search.joinpeertube.org',
+          disableLocalSearch: true,
+          isDefaultSearch: true
+        }
       }
     }
     await updateCustomConfig(server.url, server.accessToken, newCustomConfig)