From a310d068619b39d095640e7b03243a830fa83daf Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Mon, 24 Oct 2022 11:29:04 +0200 Subject: [PATCH] add tests for endpoints too --- test/api_integration/apis/core/compression.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/test/api_integration/apis/core/compression.ts b/test/api_integration/apis/core/compression.ts index 7fce62b065f73..ddad7a57e9c49 100644 --- a/test/api_integration/apis/core/compression.ts +++ b/test/api_integration/apis/core/compression.ts @@ -12,10 +12,10 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - describe('compression', () => { + const compressionSuite = (url: string) => { it(`uses compression when there isn't a referer`, async () => { await supertest - .get('/app/kibana') + .get(url) .set('accept-encoding', 'gzip') .then((response) => { expect(response.header).to.have.property('content-encoding', 'gzip'); @@ -24,7 +24,7 @@ export default function ({ getService }: FtrProviderContext) { it(`uses compression when there is a whitelisted referer`, async () => { await supertest - .get('/app/kibana') + .get(url) .set('accept-encoding', 'gzip') .set('referer', 'https://some-host.com') .then((response) => { @@ -34,7 +34,7 @@ export default function ({ getService }: FtrProviderContext) { it(`doesn't use compression when there is a non-whitelisted referer`, async () => { await supertest - .get('/app/kibana') + .get(url) .set('accept-encoding', 'gzip') .set('referer', 'https://other.some-host.com') .then((response) => { @@ -44,11 +44,20 @@ export default function ({ getService }: FtrProviderContext) { it(`supports brotli compression`, async () => { await supertest - .get('/app/kibana') + .get(url) .set('accept-encoding', 'br') .then((response) => { expect(response.header).to.have.property('content-encoding', 'br'); }); }); + }; + + describe('compression', () => { + describe('against an application page', () => { + compressionSuite('/app/kibana'); + }); + describe('against an endpoint', () => { + compressionSuite('/api/status'); + }); }); }