X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=scripts%2Fbenchmark.ts;h=45b2a7a791d05ffc667631a1f50c565654047e44;hb=cd2c3dcdc4a626a8a185b359cc40b53c8e8e0e7e;hp=69d902b5c1cc7dbb7f6edcfbe5e0d92dbd4924fa;hpb=4abbeff5758daad6d0639cc61a0ae27f9bb758da;p=github%2FChocobozzz%2FPeerTube.git diff --git a/scripts/benchmark.ts b/scripts/benchmark.ts index 69d902b5c..45b2a7a79 100644 --- a/scripts/benchmark.ts +++ b/scripts/benchmark.ts @@ -34,12 +34,47 @@ function buildAuthorizationHeader () { } } +function buildAPHeader () { + return { + Accept: 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"' + } +} + async function run () { console.log('Preparing server...') await prepare() const tests = [ + { + title: 'AP - account peertube', + path: '/accounts/peertube', + headers: buildAPHeader(), + expecter: (client, statusCode) => { + const body = client.resData[0].body + + return statusCode === 200 && body.startsWith('{"type":') + } + }, + { + title: 'AP - video', + path: '/videos/watch/' + video.uuid, + headers: buildAPHeader(), + expecter: (client, statusCode) => { + const body = client.resData[0].body + + return statusCode === 200 && body.startsWith('{"type":"Video"') + } + }, + { + title: 'Misc - webfinger peertube', + path: '/.well-known/webfinger?resource=acct:peertube@' + server.host, + expecter: (client, statusCode) => { + const body = client.resData[0].body + + return statusCode === 200 && body.startsWith('{"subject":') + } + }, { title: 'API - unread notifications', path: '/api/v1/users/me/notifications?start=0&count=0&unread=true', @@ -112,6 +147,15 @@ async function run () { return statusCode === 200 && body.includes('my super') } }, + { + title: 'HTML - video embed', + path: '/videos/embed/' + video.uuid, + expecter: (client, statusCode) => { + const body = client.resData[0].body + + return statusCode === 200 && body.includes('embed') + } + }, { title: 'HTML - homepage', path: '/',