code quality
Some checks failed
CI / lint-typecheck (pull_request) Failing after 12s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped

This commit is contained in:
2026-01-26 17:22:01 +01:00
parent cfc30c79a8
commit 9ac74f5046
305 changed files with 1192 additions and 607 deletions

View File

@@ -1,5 +1,6 @@
import { describe, expect, it, beforeEach } from 'vitest';
import { CreatePaymentPresenter } from './CreatePaymentPresenter';
import { CreatePaymentOutput } from '../dtos/PaymentsDto';
import { PaymentType, PayerType, PaymentStatus } from '@core/payments/domain/entities/Payment';
describe('CreatePaymentPresenter', () => {
let presenter: CreatePaymentPresenter;
@@ -13,14 +14,14 @@ describe('CreatePaymentPresenter', () => {
const result = {
payment: {
id: 'payment-123',
type: 'membership',
type: PaymentType.MEMBERSHIP_FEE,
amount: 100,
platformFee: 5,
netAmount: 95,
payerId: 'user-123',
payerType: 'driver',
payerType: PayerType.DRIVER,
leagueId: 'league-123',
status: 'pending',
status: PaymentStatus.PENDING,
createdAt: new Date('2024-01-01'),
},
};
@@ -31,14 +32,14 @@ describe('CreatePaymentPresenter', () => {
expect(responseModel).toEqual({
payment: {
id: 'payment-123',
type: 'membership',
type: PaymentType.MEMBERSHIP_FEE,
amount: 100,
platformFee: 5,
netAmount: 95,
payerId: 'user-123',
payerType: 'driver',
payerType: PayerType.DRIVER,
leagueId: 'league-123',
status: 'pending',
status: PaymentStatus.PENDING,
createdAt: new Date('2024-01-01'),
},
});
@@ -48,15 +49,15 @@ describe('CreatePaymentPresenter', () => {
const result = {
payment: {
id: 'payment-123',
type: 'membership',
type: PaymentType.MEMBERSHIP_FEE,
amount: 100,
platformFee: 5,
netAmount: 95,
payerId: 'user-123',
payerType: 'driver',
payerType: PayerType.DRIVER,
leagueId: 'league-123',
seasonId: 'season-123',
status: 'pending',
status: PaymentStatus.PENDING,
createdAt: new Date('2024-01-01'),
},
};
@@ -71,14 +72,14 @@ describe('CreatePaymentPresenter', () => {
const result = {
payment: {
id: 'payment-123',
type: 'membership',
type: PaymentType.MEMBERSHIP_FEE,
amount: 100,
platformFee: 5,
netAmount: 95,
payerId: 'user-123',
payerType: 'driver',
payerType: PayerType.DRIVER,
leagueId: 'league-123',
status: 'completed',
status: PaymentStatus.COMPLETED,
createdAt: new Date('2024-01-01'),
completedAt: new Date('2024-01-02'),
},
@@ -94,14 +95,14 @@ describe('CreatePaymentPresenter', () => {
const result = {
payment: {
id: 'payment-123',
type: 'membership',
type: PaymentType.MEMBERSHIP_FEE,
amount: 100,
platformFee: 5,
netAmount: 95,
payerId: 'user-123',
payerType: 'driver',
payerType: PayerType.DRIVER,
leagueId: 'league-123',
status: 'pending',
status: PaymentStatus.PENDING,
createdAt: new Date('2024-01-01'),
},
};
@@ -116,14 +117,14 @@ describe('CreatePaymentPresenter', () => {
const result = {
payment: {
id: 'payment-123',
type: 'membership',
type: PaymentType.MEMBERSHIP_FEE,
amount: 100,
platformFee: 5,
netAmount: 95,
payerId: 'user-123',
payerType: 'driver',
payerType: PayerType.DRIVER,
leagueId: 'league-123',
status: 'pending',
status: PaymentStatus.PENDING,
createdAt: new Date('2024-01-01'),
},
};
@@ -144,14 +145,14 @@ describe('CreatePaymentPresenter', () => {
const result = {
payment: {
id: 'payment-123',
type: 'membership',
type: PaymentType.MEMBERSHIP_FEE,
amount: 100,
platformFee: 5,
netAmount: 95,
payerId: 'user-123',
payerType: 'driver',
payerType: PayerType.DRIVER,
leagueId: 'league-123',
status: 'pending',
status: PaymentStatus.PENDING,
createdAt: new Date('2024-01-01'),
},
};
@@ -169,14 +170,14 @@ describe('CreatePaymentPresenter', () => {
const result = {
payment: {
id: 'payment-123',
type: 'membership',
type: PaymentType.MEMBERSHIP_FEE,
amount: 100,
platformFee: 5,
netAmount: 95,
payerId: 'user-123',
payerType: 'driver',
payerType: PayerType.DRIVER,
leagueId: 'league-123',
status: 'pending',
status: PaymentStatus.PENDING,
createdAt: new Date('2024-01-01'),
},
};
@@ -191,14 +192,14 @@ describe('CreatePaymentPresenter', () => {
const firstResult = {
payment: {
id: 'payment-123',
type: 'membership',
type: PaymentType.MEMBERSHIP_FEE,
amount: 100,
platformFee: 5,
netAmount: 95,
payerId: 'user-123',
payerType: 'driver',
payerType: PayerType.DRIVER,
leagueId: 'league-123',
status: 'pending',
status: PaymentStatus.PENDING,
createdAt: new Date('2024-01-01'),
},
};
@@ -206,14 +207,14 @@ describe('CreatePaymentPresenter', () => {
const secondResult = {
payment: {
id: 'payment-456',
type: 'membership',
type: PaymentType.MEMBERSHIP_FEE,
amount: 200,
platformFee: 10,
netAmount: 190,
payerId: 'user-456',
payerType: 'driver',
payerType: PayerType.DRIVER,
leagueId: 'league-456',
status: 'pending',
status: PaymentStatus.PENDING,
createdAt: new Date('2024-01-02'),
},
};