/**
 * API Performance Tests
 * Checks that the most common read endpoints respond within practical timing
 * thresholds during the backend test suite.
 */
const request = require('supertest');
const app = require('../../server');

describe('Performance Tests', () => {
    describe('API Response Times', () => {
        it('GET /api/atlases should respond quickly', async () => {
            const start = Date.now();
            await request(app).get('/api/atlases');
            const duration = Date.now() - start;
            expect(duration).toBeLessThan(1000); // Should be under 1 second
        });

        it('GET /api/models should respond quickly', async () => {
            const start = Date.now();
            await request(app).get('/api/models');
            const duration = Date.now() - start;
            expect(duration).toBeLessThan(2000); // Should be under 2 seconds
        });

        it('GET /api/form-schema should respond quickly', async () => {
            const start = Date.now();
            await request(app).get('/api/form-schema');
            const duration = Date.now() - start;
            expect(duration).toBeLessThan(3000); // Should be under 3 seconds
        });
    });
});