refactor: strengthen client boundaries and quality gates
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { BadRequestException } from '@nestjs/common';
|
||||
import { strictValidationPipe } from '../common/strict-validation.pipe';
|
||||
import { ClientSystemLogExportDto } from './client-operations.dto';
|
||||
|
||||
describe('ClientSystemLogExportDto', () => {
|
||||
it('accepts the supported date range and rejects extra or malformed fields', async () => {
|
||||
await expect(
|
||||
strictValidationPipe.transform(
|
||||
{ createdAtFrom: '2026-08-21', createdAtTo: '2026-08-28', level: 'error' },
|
||||
{
|
||||
type: 'body',
|
||||
metatype: ClientSystemLogExportDto,
|
||||
data: undefined,
|
||||
},
|
||||
),
|
||||
).resolves.toEqual(expect.objectContaining({ level: 'error' }));
|
||||
await expect(
|
||||
strictValidationPipe.transform(
|
||||
{ createdAtFrom: 'last-week', tenantId: 'spoofed' },
|
||||
{
|
||||
type: 'body',
|
||||
metatype: ClientSystemLogExportDto,
|
||||
data: undefined,
|
||||
},
|
||||
),
|
||||
).rejects.toBeInstanceOf(BadRequestException);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user