aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/check-params/config.ts6
-rw-r--r--server/tests/api/server/config.ts20
2 files changed, 23 insertions, 3 deletions
diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts
index efc1e4e09..c1c0a3f59 100644
--- a/server/tests/api/check-params/config.ts
+++ b/server/tests/api/check-params/config.ts
@@ -17,7 +17,11 @@ describe('Test config API validators', function () {
17 instance: { 17 instance: {
18 name: 'PeerTube updated', 18 name: 'PeerTube updated',
19 description: 'my super description', 19 description: 'my super description',
20 terms: 'my super terms' 20 terms: 'my super terms',
21 customizations: {
22 javascript: 'alert("coucou")',
23 css: 'body { background-color: red; }'
24 }
21 }, 25 },
22 cache: { 26 cache: {
23 previews: { 27 previews: {
diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts
index f1f7afef9..048135a34 100644
--- a/server/tests/api/server/config.ts
+++ b/server/tests/api/server/config.ts
@@ -3,6 +3,7 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { About } from '../../../../shared/models/config/about.model' 5import { About } from '../../../../shared/models/config/about.model'
6import { CustomConfig } from '../../../../shared/models/config/custom-config.model'
6import { deleteCustomConfig, getAbout, killallServers, reRunServer } from '../../utils' 7import { deleteCustomConfig, getAbout, killallServers, reRunServer } from '../../utils'
7const expect = chai.expect 8const expect = chai.expect
8 9
@@ -48,11 +49,13 @@ describe('Test config', function () {
48 49
49 it('Should get the customized configuration', async function () { 50 it('Should get the customized configuration', async function () {
50 const res = await getCustomConfig(server.url, server.accessToken) 51 const res = await getCustomConfig(server.url, server.accessToken)
51 const data = res.body 52 const data = res.body as CustomConfig
52 53
53 expect(data.instance.name).to.equal('PeerTube') 54 expect(data.instance.name).to.equal('PeerTube')
54 expect(data.instance.description).to.equal('Welcome to this PeerTube instance!') 55 expect(data.instance.description).to.equal('Welcome to this PeerTube instance!')
55 expect(data.instance.terms).to.equal('No terms for now.') 56 expect(data.instance.terms).to.equal('No terms for now.')
57 expect(data.instance.customizations.css).to.be.empty
58 expect(data.instance.customizations.javascript).to.be.empty
56 expect(data.cache.previews.size).to.equal(1) 59 expect(data.cache.previews.size).to.equal(1)
57 expect(data.signup.enabled).to.be.true 60 expect(data.signup.enabled).to.be.true
58 expect(data.signup.limit).to.equal(4) 61 expect(data.signup.limit).to.equal(4)
@@ -72,7 +75,11 @@ describe('Test config', function () {
72 instance: { 75 instance: {
73 name: 'PeerTube updated', 76 name: 'PeerTube updated',
74 description: 'my super description', 77 description: 'my super description',
75 terms: 'my super terms' 78 terms: 'my super terms',
79 customizations: {
80 javascript: 'alert("coucou")',
81 css: 'body { background-color: red; }'
82 }
76 }, 83 },
77 cache: { 84 cache: {
78 previews: { 85 previews: {
@@ -109,6 +116,8 @@ describe('Test config', function () {
109 expect(data.instance.name).to.equal('PeerTube updated') 116 expect(data.instance.name).to.equal('PeerTube updated')
110 expect(data.instance.description).to.equal('my super description') 117 expect(data.instance.description).to.equal('my super description')
111 expect(data.instance.terms).to.equal('my super terms') 118 expect(data.instance.terms).to.equal('my super terms')
119 expect(data.instance.customizations.javascript).to.equal('alert("coucou")')
120 expect(data.instance.customizations.css).to.equal('body { background-color: red; }')
112 expect(data.cache.previews.size).to.equal(2) 121 expect(data.cache.previews.size).to.equal(2)
113 expect(data.signup.enabled).to.be.false 122 expect(data.signup.enabled).to.be.false
114 expect(data.signup.limit).to.equal(5) 123 expect(data.signup.limit).to.equal(5)
@@ -136,6 +145,8 @@ describe('Test config', function () {
136 expect(data.instance.name).to.equal('PeerTube updated') 145 expect(data.instance.name).to.equal('PeerTube updated')
137 expect(data.instance.description).to.equal('my super description') 146 expect(data.instance.description).to.equal('my super description')
138 expect(data.instance.terms).to.equal('my super terms') 147 expect(data.instance.terms).to.equal('my super terms')
148 expect(data.instance.customizations.javascript).to.equal('alert("coucou")')
149 expect(data.instance.customizations.css).to.equal('body { background-color: red; }')
139 expect(data.cache.previews.size).to.equal(2) 150 expect(data.cache.previews.size).to.equal(2)
140 expect(data.signup.enabled).to.be.false 151 expect(data.signup.enabled).to.be.false
141 expect(data.signup.limit).to.equal(5) 152 expect(data.signup.limit).to.equal(5)
@@ -167,6 +178,11 @@ describe('Test config', function () {
167 const res = await getCustomConfig(server.url, server.accessToken) 178 const res = await getCustomConfig(server.url, server.accessToken)
168 const data = res.body 179 const data = res.body
169 180
181 expect(data.instance.name).to.equal('PeerTube')
182 expect(data.instance.description).to.equal('Welcome to this PeerTube instance!')
183 expect(data.instance.terms).to.equal('No terms for now.')
184 expect(data.instance.customizations.css).to.be.empty
185 expect(data.instance.customizations.javascript).to.be.empty
170 expect(data.cache.previews.size).to.equal(1) 186 expect(data.cache.previews.size).to.equal(1)
171 expect(data.signup.enabled).to.be.true 187 expect(data.signup.enabled).to.be.true
172 expect(data.signup.limit).to.equal(4) 188 expect(data.signup.limit).to.equal(4)