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.ts26
1 files changed, 25 insertions, 1 deletions
diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts
index 79b5aaf2d..7d21b6ce9 100644
--- a/server/tests/api/server/config.ts
+++ b/server/tests/api/server/config.ts
@@ -4,7 +4,7 @@ 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, reRunServer } from '../../utils' 7import { deleteCustomConfig, getAbout, killallServers, makeHTMLRequest, reRunServer } from '../../utils'
8const expect = chai.expect 8const expect = chai.expect
9 9
10import { 10import {
@@ -69,6 +69,12 @@ function checkUpdatedConfig (data: CustomConfig) {
69 expect(data.transcoding.resolutions['1080p']).to.be.false 69 expect(data.transcoding.resolutions['1080p']).to.be.false
70} 70}
71 71
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
72describe('Test config', function () { 78describe('Test config', function () {
73 let server = null 79 let server = null
74 80
@@ -109,6 +115,14 @@ describe('Test config', function () {
109 checkInitialConfig(data) 115 checkInitialConfig(data)
110 }) 116 })
111 117
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
112 it('Should update the customized configuration', async function () { 126 it('Should update the customized configuration', async function () {
113 const newCustomConfig: CustomConfig = { 127 const newCustomConfig: CustomConfig = {
114 instance: { 128 instance: {
@@ -167,6 +181,12 @@ describe('Test config', function () {
167 checkUpdatedConfig(data) 181 checkUpdatedConfig(data)
168 }) 182 })
169 183
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
170 it('Should have the configuration updated after a restart', async function () { 190 it('Should have the configuration updated after a restart', async function () {
171 this.timeout(10000) 191 this.timeout(10000)
172 192
@@ -178,6 +198,10 @@ describe('Test config', function () {
178 const data = res.body 198 const data = res.body
179 199
180 checkUpdatedConfig(data) 200 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; }')
181 }) 205 })
182 206
183 it('Should fetch the about information', async function () { 207 it('Should fetch the about information', async function () {