aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/server/config.ts37
1 files changed, 8 insertions, 29 deletions
diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts
index 7d21b6ce9..1782a8623 100644
--- a/server/tests/api/server/config.ts
+++ b/server/tests/api/server/config.ts
@@ -4,16 +4,19 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { About } from '../../../../shared/models/server/about.model' 5import { About } from '../../../../shared/models/server/about.model'
6import { CustomConfig } from '../../../../shared/models/server/custom-config.model' 6import { CustomConfig } from '../../../../shared/models/server/custom-config.model'
7import { deleteCustomConfig, getAbout, killallServers, makeHTMLRequest, reRunServer } from '../../utils' 7import { deleteCustomConfig, getAbout, killallServers, reRunServer } from '../../utils'
8const expect = chai.expect
9
10import { 8import {
11 getConfig,
12 flushTests, 9 flushTests,
10 getConfig,
11 getCustomConfig,
12 registerUser,
13 runServer, 13 runServer,
14 registerUser, getCustomConfig, setAccessTokensToServers, updateCustomConfig 14 setAccessTokensToServers,
15 updateCustomConfig
15} from '../../utils/index' 16} from '../../utils/index'
16 17
18const expect = chai.expect
19
17function checkInitialConfig (data: CustomConfig) { 20function checkInitialConfig (data: CustomConfig) {
18 expect(data.instance.name).to.equal('PeerTube') 21 expect(data.instance.name).to.equal('PeerTube')
19 expect(data.instance.shortDescription).to.equal( 22 expect(data.instance.shortDescription).to.equal(
@@ -69,12 +72,6 @@ function checkUpdatedConfig (data: CustomConfig) {
69 expect(data.transcoding.resolutions['1080p']).to.be.false 72 expect(data.transcoding.resolutions['1080p']).to.be.false
70} 73}
71 74
72function checkIndexTags (html: string, title: string, description: string, css: string) {
73 expect(html).to.contain('<title>' + title + '</title>')
74 expect(html).to.contain('<meta name="description" content="' + description + '" />')
75 expect(html).to.contain('<style class="custom-css-style">' + css + '</style>')
76}
77
78describe('Test config', function () { 75describe('Test config', function () {
79 let server = null 76 let server = null
80 77
@@ -115,14 +112,6 @@ describe('Test config', function () {
115 checkInitialConfig(data) 112 checkInitialConfig(data)
116 }) 113 })
117 114
118 it('Should have valid index html tags (title, description...)', async function () {
119 const res = await makeHTMLRequest(server.url, '/videos/trending')
120
121 const description = 'PeerTube, a federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser ' +
122 'with WebTorrent and Angular.'
123 checkIndexTags(res.text, 'PeerTube', description, '')
124 })
125
126 it('Should update the customized configuration', async function () { 115 it('Should update the customized configuration', async function () {
127 const newCustomConfig: CustomConfig = { 116 const newCustomConfig: CustomConfig = {
128 instance: { 117 instance: {
@@ -181,12 +170,6 @@ describe('Test config', function () {
181 checkUpdatedConfig(data) 170 checkUpdatedConfig(data)
182 }) 171 })
183 172
184 it('Should have valid index html updated tags (title, description...)', async function () {
185 const res = await makeHTMLRequest(server.url, '/videos/trending')
186
187 checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }')
188 })
189
190 it('Should have the configuration updated after a restart', async function () { 173 it('Should have the configuration updated after a restart', async function () {
191 this.timeout(10000) 174 this.timeout(10000)
192 175
@@ -198,10 +181,6 @@ describe('Test config', function () {
198 const data = res.body 181 const data = res.body
199 182
200 checkUpdatedConfig(data) 183 checkUpdatedConfig(data)
201
202 // Check HTML too
203 const resHtml = await makeHTMLRequest(server.url, '/videos/trending')
204 checkIndexTags(resHtml.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }')
205 }) 184 })
206 185
207 it('Should fetch the about information', async function () { 186 it('Should fetch the about information', async function () {