aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/client.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/client.ts')
-rw-r--r--server/tests/client.ts80
1 files changed, 79 insertions, 1 deletions
diff --git a/server/tests/client.ts b/server/tests/client.ts
index 687655452..bcbac86e9 100644
--- a/server/tests/client.ts
+++ b/server/tests/client.ts
@@ -11,8 +11,15 @@ import {
11 runServer, 11 runServer,
12 serverLogin, 12 serverLogin,
13 uploadVideo, 13 uploadVideo,
14 getVideosList, updateCustomConfig, getCustomConfig, killallServers 14 getVideosList, updateCustomConfig, getCustomConfig, killallServers, makeHTMLRequest
15} from './utils' 15} from './utils'
16import { CustomConfig } from '../../shared/models/server/custom-config.model'
17
18function checkIndexTags (html: string, title: string, description: string, css: string) {
19 expect(html).to.contain('<title>' + title + '</title>')
20 expect(html).to.contain('<meta name="description" content="' + description + '" />')
21 expect(html).to.contain('<style class="custom-css-style">' + css + '</style>')
22}
16 23
17describe('Test a client controllers', function () { 24describe('Test a client controllers', function () {
18 let server: ServerInfo 25 let server: ServerInfo
@@ -101,6 +108,77 @@ describe('Test a client controllers', function () {
101 expect(res.text).to.contain('<meta property="twitter:site" content="@Kuja" />') 108 expect(res.text).to.contain('<meta property="twitter:site" content="@Kuja" />')
102 }) 109 })
103 110
111 it('Should have valid index html tags (title, description...)', async function () {
112 const res = await makeHTMLRequest(server.url, '/videos/trending')
113
114 const description = 'PeerTube, a federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser ' +
115 'with WebTorrent and Angular.'
116 checkIndexTags(res.text, 'PeerTube', description, '')
117 })
118
119 it('Should update the customized configuration and have the correct index html tags', async function () {
120 const newCustomConfig: CustomConfig = {
121 instance: {
122 name: 'PeerTube updated',
123 shortDescription: 'my short description',
124 description: 'my super description',
125 terms: 'my super terms',
126 defaultClientRoute: '/videos/recently-added',
127 defaultNSFWPolicy: 'blur' as 'blur',
128 customizations: {
129 javascript: 'alert("coucou")',
130 css: 'body { background-color: red; }'
131 }
132 },
133 services: {
134 twitter: {
135 username: '@Kuja',
136 whitelisted: true
137 }
138 },
139 cache: {
140 previews: {
141 size: 2
142 },
143 captions: {
144 size: 3
145 }
146 },
147 signup: {
148 enabled: false,
149 limit: 5
150 },
151 admin: {
152 email: 'superadmin1@example.com'
153 },
154 user: {
155 videoQuota: 5242881
156 },
157 transcoding: {
158 enabled: true,
159 threads: 1,
160 resolutions: {
161 '240p': false,
162 '360p': true,
163 '480p': true,
164 '720p': false,
165 '1080p': false
166 }
167 }
168 }
169 await updateCustomConfig(server.url, server.accessToken, newCustomConfig)
170
171 const res = await makeHTMLRequest(server.url, '/videos/trending')
172
173 checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }')
174 })
175
176 it('Should have valid index html updated tags (title, description...)', async function () {
177 const res = await makeHTMLRequest(server.url, '/videos/trending')
178
179 checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }')
180 })
181
104 after(async function () { 182 after(async function () {
105 killallServers([ server ]) 183 killallServers([ server ])
106 }) 184 })