AI Implementation feature(820): Project Scaffold and Platform Foundations (#1)

This commit was merged in pull request #1.
This commit is contained in:
2026-07-21 14:23:53 +00:00
parent e55c9cda56
commit 03bcb6b156
131 changed files with 23657 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
import { ApiError } from '../../backend/src/common/errors/api-error';
import { ERROR_CODES } from '../../backend/src/common/errors/error-codes';
describe('ApiError', () => {
it('formats validation errors with details', () => {
const e = ApiError.validation('Bad input', { field: 'x' });
expect(e.getStatus()).toBe(400);
const body = e.getResponse() as any;
expect(body.code).toBe(ERROR_CODES.VALIDATION_FAILED);
expect(body.message).toBe('Bad input');
expect(body.details).toEqual({ field: 'x' });
});
it('formats last-admin conflict', () => {
const e = ApiError.conflict(ERROR_CODES.LAST_ADMIN, 'Cannot delete the last admin');
expect(e.getStatus()).toBe(409);
const body = e.getResponse() as any;
expect(body.code).toBe(ERROR_CODES.LAST_ADMIN);
});
it('formats internal error as 500', () => {
const e = ApiError.internal();
expect(e.getStatus()).toBe(500);
});
});