- SQLite (better-sqlite3 + TypeORM, WAL) con tabla menu_permissions (usuario web, patrón de ruta); archivo fuera del repo. - GET /api/user/menu para el frontend; GET/PUT/DELETE /api/permissions solo para administradores (acceso "*"). - ADMIN_WEB_USERS garantiza el acceso total al arrancar; no se puede quitar el "*" al último administrador (409, dentro de una transacción). - Patrones validados (`*`, `/modulo/ruta`, `/modulo/*`). A diferencia del frontend anterior, `/inventario/*` ya no habilita `/inventario-x`. - Helper de e2e compartido (SAP simulado, SQLite en memoria). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
21 lines
521 B
TypeScript
21 lines
521 B
TypeScript
import type { INestApplication } from '@nestjs/common';
|
|
import request from 'supertest';
|
|
import { createTestApp } from './support/create-test-app.js';
|
|
|
|
describe('Health (e2e)', () => {
|
|
let app: INestApplication;
|
|
|
|
beforeAll(async () => {
|
|
app = await createTestApp([]);
|
|
});
|
|
|
|
afterAll(async () => {
|
|
await app.close();
|
|
});
|
|
|
|
it('GET /api/health responde ok', async () => {
|
|
const res = await request(app.getHttpServer()).get('/api/health').expect(200);
|
|
expect(res.body.status).toBe('ok');
|
|
});
|
|
});
|