const request = require('supertest'); const fs = require('fs'); describe('OpenAPI Schema Endpoint', () => { let app; beforeAll(() => { // Import the app after modifications app = require('../index.js'); }); test('should serve OpenAPI schema at /openapi.json', async () => { // Read the expected schema from the file const expectedSchema = JSON.parse(fs.readFileSync('./openapi.json', 'utf-8')); const response = await request(app) .get('/openapi.json') .expect(200) .expect('Content-Type', /application\/json/); expect(response.body).toEqual(expectedSchema); }); });