aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--scripts/benchmark.ts44
1 files changed, 44 insertions, 0 deletions
diff --git a/scripts/benchmark.ts b/scripts/benchmark.ts
index 69d902b5c..45b2a7a79 100644
--- a/scripts/benchmark.ts
+++ b/scripts/benchmark.ts
@@ -34,6 +34,12 @@ function buildAuthorizationHeader () {
34 } 34 }
35} 35}
36 36
37function buildAPHeader () {
38 return {
39 Accept: 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
40 }
41}
42
37async function run () { 43async function run () {
38 console.log('Preparing server...') 44 console.log('Preparing server...')
39 45
@@ -41,6 +47,35 @@ async function run () {
41 47
42 const tests = [ 48 const tests = [
43 { 49 {
50 title: 'AP - account peertube',
51 path: '/accounts/peertube',
52 headers: buildAPHeader(),
53 expecter: (client, statusCode) => {
54 const body = client.resData[0].body
55
56 return statusCode === 200 && body.startsWith('{"type":')
57 }
58 },
59 {
60 title: 'AP - video',
61 path: '/videos/watch/' + video.uuid,
62 headers: buildAPHeader(),
63 expecter: (client, statusCode) => {
64 const body = client.resData[0].body
65
66 return statusCode === 200 && body.startsWith('{"type":"Video"')
67 }
68 },
69 {
70 title: 'Misc - webfinger peertube',
71 path: '/.well-known/webfinger?resource=acct:peertube@' + server.host,
72 expecter: (client, statusCode) => {
73 const body = client.resData[0].body
74
75 return statusCode === 200 && body.startsWith('{"subject":')
76 }
77 },
78 {
44 title: 'API - unread notifications', 79 title: 'API - unread notifications',
45 path: '/api/v1/users/me/notifications?start=0&count=0&unread=true', 80 path: '/api/v1/users/me/notifications?start=0&count=0&unread=true',
46 headers: buildAuthorizationHeader(), 81 headers: buildAuthorizationHeader(),
@@ -113,6 +148,15 @@ async function run () {
113 } 148 }
114 }, 149 },
115 { 150 {
151 title: 'HTML - video embed',
152 path: '/videos/embed/' + video.uuid,
153 expecter: (client, statusCode) => {
154 const body = client.resData[0].body
155
156 return statusCode === 200 && body.includes('embed')
157 }
158 },
159 {
116 title: 'HTML - homepage', 160 title: 'HTML - homepage',
117 path: '/', 161 path: '/',
118 expecter: (_client, statusCode) => { 162 expecter: (_client, statusCode) => {