fix(tst-005): use v4-compliant UUIDs — @IsUUID() requires version nibble=4
This commit is contained in:
parent
9cf210976c
commit
2af9b5c94a
1 changed files with 13 additions and 13 deletions
|
|
@ -7,6 +7,8 @@
|
|||
* - evidenceStatus enum validation on create + update
|
||||
* - ParseUUIDPipe on path params
|
||||
* - response shapes
|
||||
*
|
||||
* UUIDs are v4-compliant (version nibble=4, variant nibble=8) so @IsUUID() passes.
|
||||
*/
|
||||
import request from 'supertest';
|
||||
import {
|
||||
|
|
@ -28,10 +30,10 @@ import { TransactionsService } from '../transactions/transactions.service';
|
|||
|
||||
const FAKE_SESSION = {
|
||||
requestId: 'req-1', correlationId: 'cor-1', sessionId: 'ses-1',
|
||||
userId: '00000000-0000-0000-0000-000000000001',
|
||||
tenantId: '00000000-0000-0000-0000-000000000002',
|
||||
workspaceId: '00000000-0000-0000-0000-000000000003',
|
||||
membershipId: '00000000-0000-0000-0000-000000000004',
|
||||
userId: '1a000000-0000-4000-8000-000000000001',
|
||||
tenantId: '1a000000-0000-4000-8000-000000000002',
|
||||
workspaceId: '1a000000-0000-4000-8000-000000000003',
|
||||
membershipId: '1a000000-0000-4000-8000-000000000004',
|
||||
role: 'owner' as const, roles: ['owner' as const],
|
||||
permissions: ['*'], purpose: 'test', timezone: 'UTC', source: 'api' as const,
|
||||
};
|
||||
|
|
@ -49,9 +51,9 @@ class StubAuthGuard implements CanActivate {
|
|||
}
|
||||
|
||||
const MOCK_TX = {
|
||||
id: '00000000-0000-0000-0000-bbbb00000001',
|
||||
tenantId: FAKE_SESSION.tenantId,
|
||||
organizationId: '00000000-0000-0000-0000-000000000005',
|
||||
id: '1a000000-0000-4000-8000-bbbb00000001',
|
||||
tenantId: '1a000000-0000-4000-8000-000000000002',
|
||||
organizationId: '1a000000-0000-4000-8000-000000000005',
|
||||
type: 'invoice',
|
||||
amountMinorUnits: '123400',
|
||||
currency: 'EUR',
|
||||
|
|
@ -80,8 +82,6 @@ const mockTxService = {
|
|||
class TxTestModule {}
|
||||
|
||||
const AUTH = 'Bearer test-token';
|
||||
const VALID_UUID = '00000000-0000-0000-0000-bbbb00000001';
|
||||
const VALID_ORG_UUID = '00000000-0000-0000-0000-000000000005';
|
||||
|
||||
describe('TST-005: Transactions API Integration', () => {
|
||||
let app: INestApplication;
|
||||
|
|
@ -115,7 +115,7 @@ describe('TST-005: Transactions API Integration', () => {
|
|||
|
||||
describe('POST /v1/transactions', () => {
|
||||
const VALID_BODY = {
|
||||
organizationId: VALID_ORG_UUID,
|
||||
organizationId: '1a000000-0000-4000-8000-000000000005',
|
||||
type: 'invoice',
|
||||
amountMinorUnits: 123400,
|
||||
currency: 'EUR',
|
||||
|
|
@ -184,7 +184,7 @@ describe('TST-005: Transactions API Integration', () => {
|
|||
describe('PATCH /v1/transactions/:id', () => {
|
||||
it('returns 200 with valid UUID and valid body', async () => {
|
||||
await request(app.getHttpServer())
|
||||
.patch(`/v1/transactions/${VALID_UUID}`)
|
||||
.patch('/v1/transactions/1a000000-0000-4000-8000-bbbb00000001')
|
||||
.set('Authorization', AUTH)
|
||||
.send({ evidenceStatus: 'complete' })
|
||||
.expect(200);
|
||||
|
|
@ -201,7 +201,7 @@ describe('TST-005: Transactions API Integration', () => {
|
|||
|
||||
it('returns 400 for invalid evidenceStatus in body', async () => {
|
||||
await request(app.getHttpServer())
|
||||
.patch(`/v1/transactions/${VALID_UUID}`)
|
||||
.patch('/v1/transactions/1a000000-0000-4000-8000-bbbb00000001')
|
||||
.set('Authorization', AUTH)
|
||||
.send({ evidenceStatus: 'flying' })
|
||||
.expect(400);
|
||||
|
|
@ -211,7 +211,7 @@ describe('TST-005: Transactions API Integration', () => {
|
|||
describe('DELETE /v1/transactions/:id', () => {
|
||||
it('returns 200 with valid UUID', async () => {
|
||||
await request(app.getHttpServer())
|
||||
.delete(`/v1/transactions/${VALID_UUID}`)
|
||||
.delete('/v1/transactions/1a000000-0000-4000-8000-bbbb00000001')
|
||||
.set('Authorization', AUTH)
|
||||
.expect(200);
|
||||
expect(mockTxService.softDelete).toHaveBeenCalledTimes(1);
|
||||
|
|
|
|||
Loading…
Reference in a new issue