From 8a931228821b2dd47ac15003e5c2f2dfe24d71b4 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Sun, 15 Dec 2024 18:55:10 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=85(yprovider)=20add=20test=20to=20preven?= =?UTF-8?q?t=20silent=20breaking=20changes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per Quentin's request, added a test to ensure developers are warned if the token format is updated, preventing backend compatibility issues. --- .../servers/y-provider/__tests__/server.test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/frontend/servers/y-provider/__tests__/server.test.ts b/src/frontend/servers/y-provider/__tests__/server.test.ts index 47b26e1e..7e9fe4c8 100644 --- a/src/frontend/servers/y-provider/__tests__/server.test.ts +++ b/src/frontend/servers/y-provider/__tests__/server.test.ts @@ -101,6 +101,16 @@ describe('Server Tests', () => { expect(response.body.error).toBe('Forbidden: Invalid API Key'); }); + test('POST /api/convert-markdown with a Bearer token', async () => { + const response = await request(app as any) + .post('/api/convert-markdown') + .set('Origin', origin) + .set('Authorization', 'Bearer test-secret-api-key'); + + // Warning: Changing the authorization header to Bearer token format will break backend compatibility with this microservice. + expect(response.status).toBe(403); + }); + test('POST /api/convert-markdown with missing body param content', async () => { const response = await request(app as any) .post('/api/convert-markdown')