(yprovider) add test to prevent silent breaking changes

Per Quentin's request, added a test to ensure developers are warned
if the token format is updated, preventing backend compatibility issues.
This commit is contained in:
lebaudantoine
2024-12-15 18:55:10 +01:00
committed by aleb_the_flash
parent 8eb986591a
commit 8a93122882

View File

@@ -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')