]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/server/config.ts
Merge branch 'release/2.2.0' into develop
[github/Chocobozzz/PeerTube.git] / server / tests / api / server / config.ts
index 85d0f970215198fb8ccab404f3988cf8de1e46fb..d18a930823e85daf8ad0909b857c5780a8a71dbb 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!')
 
@@ -36,6 +38,7 @@ function checkInitialConfig (server: ServerInfo, data: CustomConfig) {
   expect(data.instance.administrator).to.be.empty
   expect(data.instance.maintenanceLifetime).to.be.empty
   expect(data.instance.businessModel).to.be.empty
+  expect(data.instance.hardwareInformation).to.be.empty
 
   expect(data.instance.languages).to.have.lengthOf(0)
   expect(data.instance.categories).to.have.lengthOf(0)
@@ -71,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
@@ -82,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) {
@@ -97,6 +106,7 @@ function checkUpdatedConfig (data: CustomConfig) {
   expect(data.instance.administrator).to.equal('Kuja')
   expect(data.instance.maintenanceLifetime).to.equal('forever')
   expect(data.instance.businessModel).to.equal('my super business model')
+  expect(data.instance.hardwareInformation).to.equal('2vCore 3GB RAM')
 
   expect(data.instance.languages).to.deep.equal([ 'en', 'es' ])
   expect(data.instance.categories).to.deep.equal([ 1, 2 ])
@@ -138,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
@@ -149,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 () {
@@ -219,6 +235,7 @@ describe('Test config', function () {
         administrator: 'Kuja',
         maintenanceLifetime: 'forever',
         businessModel: 'my super business model',
+        hardwareInformation: '2vCore 3GB RAM',
 
         languages: [ 'en', 'es' ],
         categories: [ 1, 2 ],
@@ -269,6 +286,7 @@ describe('Test config', function () {
         allowAudioFiles: true,
         threads: 1,
         resolutions: {
+          '0p': false,
           '240p': false,
           '360p': true,
           '480p': true,
@@ -276,6 +294,9 @@ describe('Test config', function () {
           '1080p': false,
           '2160p': false
         },
+        webtorrent: {
+          enabled: true
+        },
         hls: {
           enabled: false
         }
@@ -313,6 +334,12 @@ describe('Test config', function () {
             indexUrl: 'https://updated.example.com'
           }
         }
+      },
+      broadcastMessage: {
+        enabled: true,
+        level: 'error',
+        message: 'super bad message',
+        dismissable: true
       }
     }
     await updateCustomConfig(server.url, server.accessToken, newCustomConfig)
@@ -362,6 +389,17 @@ describe('Test config', function () {
     expect(data.instance.shortDescription).to.equal('my short description')
     expect(data.instance.description).to.equal('my super description')
     expect(data.instance.terms).to.equal('my super terms')
+    expect(data.instance.codeOfConduct).to.equal('my super coc')
+
+    expect(data.instance.creationReason).to.equal('my super creation reason')
+    expect(data.instance.moderationInformation).to.equal('my super moderation information')
+    expect(data.instance.administrator).to.equal('Kuja')
+    expect(data.instance.maintenanceLifetime).to.equal('forever')
+    expect(data.instance.businessModel).to.equal('my super business model')
+    expect(data.instance.hardwareInformation).to.equal('2vCore 3GB RAM')
+
+    expect(data.instance.languages).to.deep.equal([ 'en', 'es' ])
+    expect(data.instance.categories).to.deep.equal([ 1, 2 ])
   })
 
   it('Should remove the custom configuration', async function () {