import request from 'supertest'; import { app } from '../src/app'; describe('API contract smoke tests', () => { it('returns JSON parse config shape', async () => { const response = await request(app).get('/api/config/parse'); expect(response.status).toBe(200); expect(response.body).toEqual({ appId: expect.any(String), jsKey: expect.any(String), serverUrl: expect.any(String) }); }); it('does not expose Parse master key in public config', async () => { const response = await request(app).get('/api/config/parse'); expect(response.body.masterKey).toBeUndefined(); expect(response.body.restApiKey).toBeUndefined(); }); it('returns 404 for unknown api route', async () => { const response = await request(app).get('/api/unknown-resource'); expect(response.status).toBe(404); expect(response.body.code).toBe('NOT_FOUND'); }); it('includes method and path in not found message', async () => { const response = await request(app).post('/api/ghost'); expect(response.status).toBe(404); expect(response.body.message).toContain('POST /api/ghost'); }); });