forked from Shared/esg
Implement normalized error handling with Persian translations across all exception types, replace legacy NestJS exceptions with AppException, and add unit, integration, and smoke tests. - Add error catalog with gateway-owned codes and Persian messages - Introduce AppException wrapping normalized error envelopes - Add translateError helper for automatic messageFa population - Remove claims module and update provider error normalization - Add unit tests for error contracts and helper functions - Add integration tests for admin and inquiry endpoints - Add smoke tests for real provider connectivity - Add test support utilities (auth mocks, assertions, app factory)
24 lines
584 B
TypeScript
24 lines
584 B
TypeScript
import { Response } from 'supertest';
|
|
|
|
export function expectSuccessEnvelope(response: Response): void {
|
|
expect(response.body).toMatchObject({
|
|
success: true,
|
|
trackingCode: expect.any(String),
|
|
provider: expect.any(String),
|
|
duration: expect.any(Number),
|
|
error: null,
|
|
});
|
|
}
|
|
|
|
export function expectErrorEnvelope(response: Response, code: string): void {
|
|
expect(response.body).toMatchObject({
|
|
success: false,
|
|
trackingCode: expect.any(String),
|
|
error: {
|
|
code,
|
|
message: expect.any(String),
|
|
messageFa: expect.any(String),
|
|
},
|
|
});
|
|
}
|