aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/client.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-16 10:42:24 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commitc0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea (patch)
treebaf29753ac5d4598643e3bee719f8df0cc36c59d /server/tests/client.ts
parent08642a765ea514a00f159db898edf14c376fbe6c (diff)
downloadPeerTube-c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea.tar.gz
PeerTube-c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea.tar.zst
PeerTube-c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea.zip
Refactor requests
Diffstat (limited to 'server/tests/client.ts')
-rw-r--r--server/tests/client.ts30
1 files changed, 15 insertions, 15 deletions
diff --git a/server/tests/client.ts b/server/tests/client.ts
index 959b34653..6255c6961 100644
--- a/server/tests/client.ts
+++ b/server/tests/client.ts
@@ -3,7 +3,7 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { omit } from 'lodash' 5import { omit } from 'lodash'
6import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' 6import { HttpStatusCode } from '@shared/models'
7import { Account, HTMLServerConfig, ServerConfig, VideoPlaylistCreateResult, VideoPlaylistPrivacy } from '@shared/models' 7import { Account, HTMLServerConfig, ServerConfig, VideoPlaylistCreateResult, VideoPlaylistPrivacy } from '@shared/models'
8import { 8import {
9 cleanupTests, 9 cleanupTests,
@@ -114,7 +114,7 @@ describe('Test a client controllers', function () {
114 url: servers[0].url, 114 url: servers[0].url,
115 path: basePath + id, 115 path: basePath + id,
116 accept: 'text/html', 116 accept: 'text/html',
117 statusCodeExpected: HttpStatusCode.OK_200 117 expectedStatus: HttpStatusCode.OK_200
118 }) 118 })
119 119
120 const port = servers[0].port 120 const port = servers[0].port
@@ -135,7 +135,7 @@ describe('Test a client controllers', function () {
135 url: servers[0].url, 135 url: servers[0].url,
136 path: basePath + id, 136 path: basePath + id,
137 accept: 'text/html', 137 accept: 'text/html',
138 statusCodeExpected: HttpStatusCode.OK_200 138 expectedStatus: HttpStatusCode.OK_200
139 }) 139 })
140 140
141 const port = servers[0].port 141 const port = servers[0].port
@@ -153,7 +153,7 @@ describe('Test a client controllers', function () {
153 describe('Open Graph', function () { 153 describe('Open Graph', function () {
154 154
155 async function accountPageTest (path: string) { 155 async function accountPageTest (path: string) {
156 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', statusCodeExpected: HttpStatusCode.OK_200 }) 156 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', expectedStatus: HttpStatusCode.OK_200 })
157 const text = res.text 157 const text = res.text
158 158
159 expect(text).to.contain(`<meta property="og:title" content="${account.displayName}" />`) 159 expect(text).to.contain(`<meta property="og:title" content="${account.displayName}" />`)
@@ -163,7 +163,7 @@ describe('Test a client controllers', function () {
163 } 163 }
164 164
165 async function channelPageTest (path: string) { 165 async function channelPageTest (path: string) {
166 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', statusCodeExpected: HttpStatusCode.OK_200 }) 166 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', expectedStatus: HttpStatusCode.OK_200 })
167 const text = res.text 167 const text = res.text
168 168
169 expect(text).to.contain(`<meta property="og:title" content="${servers[0].store.channel.displayName}" />`) 169 expect(text).to.contain(`<meta property="og:title" content="${servers[0].store.channel.displayName}" />`)
@@ -173,7 +173,7 @@ describe('Test a client controllers', function () {
173 } 173 }
174 174
175 async function watchVideoPageTest (path: string) { 175 async function watchVideoPageTest (path: string) {
176 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', statusCodeExpected: HttpStatusCode.OK_200 }) 176 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', expectedStatus: HttpStatusCode.OK_200 })
177 const text = res.text 177 const text = res.text
178 178
179 expect(text).to.contain(`<meta property="og:title" content="${videoName}" />`) 179 expect(text).to.contain(`<meta property="og:title" content="${videoName}" />`)
@@ -183,7 +183,7 @@ describe('Test a client controllers', function () {
183 } 183 }
184 184
185 async function watchPlaylistPageTest (path: string) { 185 async function watchPlaylistPageTest (path: string) {
186 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', statusCodeExpected: HttpStatusCode.OK_200 }) 186 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', expectedStatus: HttpStatusCode.OK_200 })
187 const text = res.text 187 const text = res.text
188 188
189 expect(text).to.contain(`<meta property="og:title" content="${playlistName}" />`) 189 expect(text).to.contain(`<meta property="og:title" content="${playlistName}" />`)
@@ -226,7 +226,7 @@ describe('Test a client controllers', function () {
226 describe('Not whitelisted', function () { 226 describe('Not whitelisted', function () {
227 227
228 async function accountPageTest (path: string) { 228 async function accountPageTest (path: string) {
229 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', statusCodeExpected: HttpStatusCode.OK_200 }) 229 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', expectedStatus: HttpStatusCode.OK_200 })
230 const text = res.text 230 const text = res.text
231 231
232 expect(text).to.contain('<meta property="twitter:card" content="summary" />') 232 expect(text).to.contain('<meta property="twitter:card" content="summary" />')
@@ -236,7 +236,7 @@ describe('Test a client controllers', function () {
236 } 236 }
237 237
238 async function channelPageTest (path: string) { 238 async function channelPageTest (path: string) {
239 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', statusCodeExpected: HttpStatusCode.OK_200 }) 239 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', expectedStatus: HttpStatusCode.OK_200 })
240 const text = res.text 240 const text = res.text
241 241
242 expect(text).to.contain('<meta property="twitter:card" content="summary" />') 242 expect(text).to.contain('<meta property="twitter:card" content="summary" />')
@@ -246,7 +246,7 @@ describe('Test a client controllers', function () {
246 } 246 }
247 247
248 async function watchVideoPageTest (path: string) { 248 async function watchVideoPageTest (path: string) {
249 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', statusCodeExpected: HttpStatusCode.OK_200 }) 249 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', expectedStatus: HttpStatusCode.OK_200 })
250 const text = res.text 250 const text = res.text
251 251
252 expect(text).to.contain('<meta property="twitter:card" content="summary_large_image" />') 252 expect(text).to.contain('<meta property="twitter:card" content="summary_large_image" />')
@@ -256,7 +256,7 @@ describe('Test a client controllers', function () {
256 } 256 }
257 257
258 async function watchPlaylistPageTest (path: string) { 258 async function watchPlaylistPageTest (path: string) {
259 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', statusCodeExpected: HttpStatusCode.OK_200 }) 259 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', expectedStatus: HttpStatusCode.OK_200 })
260 const text = res.text 260 const text = res.text
261 261
262 expect(text).to.contain('<meta property="twitter:card" content="summary" />') 262 expect(text).to.contain('<meta property="twitter:card" content="summary" />')
@@ -307,7 +307,7 @@ describe('Test a client controllers', function () {
307 }) 307 })
308 308
309 async function accountPageTest (path: string) { 309 async function accountPageTest (path: string) {
310 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', statusCodeExpected: HttpStatusCode.OK_200 }) 310 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', expectedStatus: HttpStatusCode.OK_200 })
311 const text = res.text 311 const text = res.text
312 312
313 expect(text).to.contain('<meta property="twitter:card" content="summary" />') 313 expect(text).to.contain('<meta property="twitter:card" content="summary" />')
@@ -315,7 +315,7 @@ describe('Test a client controllers', function () {
315 } 315 }
316 316
317 async function channelPageTest (path: string) { 317 async function channelPageTest (path: string) {
318 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', statusCodeExpected: HttpStatusCode.OK_200 }) 318 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', expectedStatus: HttpStatusCode.OK_200 })
319 const text = res.text 319 const text = res.text
320 320
321 expect(text).to.contain('<meta property="twitter:card" content="summary" />') 321 expect(text).to.contain('<meta property="twitter:card" content="summary" />')
@@ -323,7 +323,7 @@ describe('Test a client controllers', function () {
323 } 323 }
324 324
325 async function watchVideoPageTest (path: string) { 325 async function watchVideoPageTest (path: string) {
326 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', statusCodeExpected: HttpStatusCode.OK_200 }) 326 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', expectedStatus: HttpStatusCode.OK_200 })
327 const text = res.text 327 const text = res.text
328 328
329 expect(text).to.contain('<meta property="twitter:card" content="player" />') 329 expect(text).to.contain('<meta property="twitter:card" content="player" />')
@@ -331,7 +331,7 @@ describe('Test a client controllers', function () {
331 } 331 }
332 332
333 async function watchPlaylistPageTest (path: string) { 333 async function watchPlaylistPageTest (path: string) {
334 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', statusCodeExpected: HttpStatusCode.OK_200 }) 334 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', expectedStatus: HttpStatusCode.OK_200 })
335 const text = res.text 335 const text = res.text
336 336
337 expect(text).to.contain('<meta property="twitter:card" content="player" />') 337 expect(text).to.contain('<meta property="twitter:card" content="player" />')