diff options
Diffstat (limited to 'server/tests/client.ts')
-rw-r--r-- | server/tests/client.ts | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/server/tests/client.ts b/server/tests/client.ts index 96821eb6f..6dd4b7cf6 100644 --- a/server/tests/client.ts +++ b/server/tests/client.ts | |||
@@ -22,6 +22,7 @@ import { | |||
22 | updateMyUser, | 22 | updateMyUser, |
23 | updateVideoChannel | 23 | updateVideoChannel |
24 | } from '../../shared/extra-utils' | 24 | } from '../../shared/extra-utils' |
25 | import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' | ||
25 | 26 | ||
26 | const expect = chai.expect | 27 | const expect = chai.expect |
27 | 28 | ||
@@ -100,7 +101,7 @@ describe('Test a client controllers', function () { | |||
100 | const res = await request(server.url) | 101 | const res = await request(server.url) |
101 | .get(path) | 102 | .get(path) |
102 | .set('Accept', 'text/html') | 103 | .set('Accept', 'text/html') |
103 | .expect(200) | 104 | .expect(HttpStatusCode.OK_200) |
104 | 105 | ||
105 | const port = server.port | 106 | const port = server.port |
106 | 107 | ||
@@ -115,7 +116,7 @@ describe('Test a client controllers', function () { | |||
115 | const res = await request(server.url) | 116 | const res = await request(server.url) |
116 | .get('/videos/watch/playlist/' + playlistUUID) | 117 | .get('/videos/watch/playlist/' + playlistUUID) |
117 | .set('Accept', 'text/html') | 118 | .set('Accept', 'text/html') |
118 | .expect(200) | 119 | .expect(HttpStatusCode.OK_200) |
119 | 120 | ||
120 | const port = server.port | 121 | const port = server.port |
121 | 122 | ||
@@ -133,7 +134,7 @@ describe('Test a client controllers', function () { | |||
133 | const res = await request(server.url) | 134 | const res = await request(server.url) |
134 | .get('/accounts/' + server.user.username) | 135 | .get('/accounts/' + server.user.username) |
135 | .set('Accept', 'text/html') | 136 | .set('Accept', 'text/html') |
136 | .expect(200) | 137 | .expect(HttpStatusCode.OK_200) |
137 | 138 | ||
138 | expect(res.text).to.contain(`<meta property="og:title" content="${account.displayName}" />`) | 139 | expect(res.text).to.contain(`<meta property="og:title" content="${account.displayName}" />`) |
139 | expect(res.text).to.contain(`<meta property="og:description" content="${account.description}" />`) | 140 | expect(res.text).to.contain(`<meta property="og:description" content="${account.description}" />`) |
@@ -145,7 +146,7 @@ describe('Test a client controllers', function () { | |||
145 | const res = await request(server.url) | 146 | const res = await request(server.url) |
146 | .get('/video-channels/' + server.videoChannel.name) | 147 | .get('/video-channels/' + server.videoChannel.name) |
147 | .set('Accept', 'text/html') | 148 | .set('Accept', 'text/html') |
148 | .expect(200) | 149 | .expect(HttpStatusCode.OK_200) |
149 | 150 | ||
150 | expect(res.text).to.contain(`<meta property="og:title" content="${server.videoChannel.displayName}" />`) | 151 | expect(res.text).to.contain(`<meta property="og:title" content="${server.videoChannel.displayName}" />`) |
151 | expect(res.text).to.contain(`<meta property="og:description" content="${channelDescription}" />`) | 152 | expect(res.text).to.contain(`<meta property="og:description" content="${channelDescription}" />`) |
@@ -157,7 +158,7 @@ describe('Test a client controllers', function () { | |||
157 | const res = await request(server.url) | 158 | const res = await request(server.url) |
158 | .get('/videos/watch/' + server.video.id) | 159 | .get('/videos/watch/' + server.video.id) |
159 | .set('Accept', 'text/html') | 160 | .set('Accept', 'text/html') |
160 | .expect(200) | 161 | .expect(HttpStatusCode.OK_200) |
161 | 162 | ||
162 | expect(res.text).to.contain(`<meta property="og:title" content="${videoName}" />`) | 163 | expect(res.text).to.contain(`<meta property="og:title" content="${videoName}" />`) |
163 | expect(res.text).to.contain(`<meta property="og:description" content="${videoDescription}" />`) | 164 | expect(res.text).to.contain(`<meta property="og:description" content="${videoDescription}" />`) |
@@ -169,7 +170,7 @@ describe('Test a client controllers', function () { | |||
169 | const res = await request(server.url) | 170 | const res = await request(server.url) |
170 | .get('/videos/watch/' + server.video.uuid) | 171 | .get('/videos/watch/' + server.video.uuid) |
171 | .set('Accept', 'text/html') | 172 | .set('Accept', 'text/html') |
172 | .expect(200) | 173 | .expect(HttpStatusCode.OK_200) |
173 | 174 | ||
174 | expect(res.text).to.contain(`<meta property="og:title" content="${videoName}" />`) | 175 | expect(res.text).to.contain(`<meta property="og:title" content="${videoName}" />`) |
175 | expect(res.text).to.contain(`<meta property="og:description" content="${videoDescription}" />`) | 176 | expect(res.text).to.contain(`<meta property="og:description" content="${videoDescription}" />`) |
@@ -181,7 +182,7 @@ describe('Test a client controllers', function () { | |||
181 | const res = await request(server.url) | 182 | const res = await request(server.url) |
182 | .get('/videos/watch/playlist/' + playlistUUID) | 183 | .get('/videos/watch/playlist/' + playlistUUID) |
183 | .set('Accept', 'text/html') | 184 | .set('Accept', 'text/html') |
184 | .expect(200) | 185 | .expect(HttpStatusCode.OK_200) |
185 | 186 | ||
186 | expect(res.text).to.contain(`<meta property="og:title" content="${playlistName}" />`) | 187 | expect(res.text).to.contain(`<meta property="og:title" content="${playlistName}" />`) |
187 | expect(res.text).to.contain(`<meta property="og:description" content="${playlistDescription}" />`) | 188 | expect(res.text).to.contain(`<meta property="og:description" content="${playlistDescription}" />`) |
@@ -196,7 +197,7 @@ describe('Test a client controllers', function () { | |||
196 | const res = await request(server.url) | 197 | const res = await request(server.url) |
197 | .get('/videos/watch/' + server.video.uuid) | 198 | .get('/videos/watch/' + server.video.uuid) |
198 | .set('Accept', 'text/html') | 199 | .set('Accept', 'text/html') |
199 | .expect(200) | 200 | .expect(HttpStatusCode.OK_200) |
200 | 201 | ||
201 | expect(res.text).to.contain('<meta property="twitter:card" content="summary_large_image" />') | 202 | expect(res.text).to.contain('<meta property="twitter:card" content="summary_large_image" />') |
202 | expect(res.text).to.contain('<meta property="twitter:site" content="@Chocobozzz" />') | 203 | expect(res.text).to.contain('<meta property="twitter:site" content="@Chocobozzz" />') |
@@ -208,7 +209,7 @@ describe('Test a client controllers', function () { | |||
208 | const res = await request(server.url) | 209 | const res = await request(server.url) |
209 | .get('/videos/watch/playlist/' + playlistUUID) | 210 | .get('/videos/watch/playlist/' + playlistUUID) |
210 | .set('Accept', 'text/html') | 211 | .set('Accept', 'text/html') |
211 | .expect(200) | 212 | .expect(HttpStatusCode.OK_200) |
212 | 213 | ||
213 | expect(res.text).to.contain('<meta property="twitter:card" content="summary" />') | 214 | expect(res.text).to.contain('<meta property="twitter:card" content="summary" />') |
214 | expect(res.text).to.contain('<meta property="twitter:site" content="@Chocobozzz" />') | 215 | expect(res.text).to.contain('<meta property="twitter:site" content="@Chocobozzz" />') |
@@ -220,7 +221,7 @@ describe('Test a client controllers', function () { | |||
220 | const res = await request(server.url) | 221 | const res = await request(server.url) |
221 | .get('/accounts/' + account.name) | 222 | .get('/accounts/' + account.name) |
222 | .set('Accept', 'text/html') | 223 | .set('Accept', 'text/html') |
223 | .expect(200) | 224 | .expect(HttpStatusCode.OK_200) |
224 | 225 | ||
225 | expect(res.text).to.contain('<meta property="twitter:card" content="summary" />') | 226 | expect(res.text).to.contain('<meta property="twitter:card" content="summary" />') |
226 | expect(res.text).to.contain('<meta property="twitter:site" content="@Chocobozzz" />') | 227 | expect(res.text).to.contain('<meta property="twitter:site" content="@Chocobozzz" />') |
@@ -232,7 +233,7 @@ describe('Test a client controllers', function () { | |||
232 | const res = await request(server.url) | 233 | const res = await request(server.url) |
233 | .get('/video-channels/' + server.videoChannel.name) | 234 | .get('/video-channels/' + server.videoChannel.name) |
234 | .set('Accept', 'text/html') | 235 | .set('Accept', 'text/html') |
235 | .expect(200) | 236 | .expect(HttpStatusCode.OK_200) |
236 | 237 | ||
237 | expect(res.text).to.contain('<meta property="twitter:card" content="summary" />') | 238 | expect(res.text).to.contain('<meta property="twitter:card" content="summary" />') |
238 | expect(res.text).to.contain('<meta property="twitter:site" content="@Chocobozzz" />') | 239 | expect(res.text).to.contain('<meta property="twitter:site" content="@Chocobozzz" />') |
@@ -252,7 +253,7 @@ describe('Test a client controllers', function () { | |||
252 | const resVideoRequest = await request(server.url) | 253 | const resVideoRequest = await request(server.url) |
253 | .get('/videos/watch/' + server.video.uuid) | 254 | .get('/videos/watch/' + server.video.uuid) |
254 | .set('Accept', 'text/html') | 255 | .set('Accept', 'text/html') |
255 | .expect(200) | 256 | .expect(HttpStatusCode.OK_200) |
256 | 257 | ||
257 | expect(resVideoRequest.text).to.contain('<meta property="twitter:card" content="player" />') | 258 | expect(resVideoRequest.text).to.contain('<meta property="twitter:card" content="player" />') |
258 | expect(resVideoRequest.text).to.contain('<meta property="twitter:site" content="@Kuja" />') | 259 | expect(resVideoRequest.text).to.contain('<meta property="twitter:site" content="@Kuja" />') |
@@ -260,7 +261,7 @@ describe('Test a client controllers', function () { | |||
260 | const resVideoPlaylistRequest = await request(server.url) | 261 | const resVideoPlaylistRequest = await request(server.url) |
261 | .get('/videos/watch/playlist/' + playlistUUID) | 262 | .get('/videos/watch/playlist/' + playlistUUID) |
262 | .set('Accept', 'text/html') | 263 | .set('Accept', 'text/html') |
263 | .expect(200) | 264 | .expect(HttpStatusCode.OK_200) |
264 | 265 | ||
265 | expect(resVideoPlaylistRequest.text).to.contain('<meta property="twitter:card" content="player" />') | 266 | expect(resVideoPlaylistRequest.text).to.contain('<meta property="twitter:card" content="player" />') |
266 | expect(resVideoPlaylistRequest.text).to.contain('<meta property="twitter:site" content="@Kuja" />') | 267 | expect(resVideoPlaylistRequest.text).to.contain('<meta property="twitter:site" content="@Kuja" />') |
@@ -268,7 +269,7 @@ describe('Test a client controllers', function () { | |||
268 | const resAccountRequest = await request(server.url) | 269 | const resAccountRequest = await request(server.url) |
269 | .get('/accounts/' + account.name) | 270 | .get('/accounts/' + account.name) |
270 | .set('Accept', 'text/html') | 271 | .set('Accept', 'text/html') |
271 | .expect(200) | 272 | .expect(HttpStatusCode.OK_200) |
272 | 273 | ||
273 | expect(resAccountRequest.text).to.contain('<meta property="twitter:card" content="summary" />') | 274 | expect(resAccountRequest.text).to.contain('<meta property="twitter:card" content="summary" />') |
274 | expect(resAccountRequest.text).to.contain('<meta property="twitter:site" content="@Kuja" />') | 275 | expect(resAccountRequest.text).to.contain('<meta property="twitter:site" content="@Kuja" />') |
@@ -276,7 +277,7 @@ describe('Test a client controllers', function () { | |||
276 | const resChannelRequest = await request(server.url) | 277 | const resChannelRequest = await request(server.url) |
277 | .get('/video-channels/' + server.videoChannel.name) | 278 | .get('/video-channels/' + server.videoChannel.name) |
278 | .set('Accept', 'text/html') | 279 | .set('Accept', 'text/html') |
279 | .expect(200) | 280 | .expect(HttpStatusCode.OK_200) |
280 | 281 | ||
281 | expect(resChannelRequest.text).to.contain('<meta property="twitter:card" content="summary" />') | 282 | expect(resChannelRequest.text).to.contain('<meta property="twitter:card" content="summary" />') |
282 | expect(resChannelRequest.text).to.contain('<meta property="twitter:site" content="@Kuja" />') | 283 | expect(resChannelRequest.text).to.contain('<meta property="twitter:site" content="@Kuja" />') |