fix payment customer and dashboard settings
Build & Deploy / Build & Push Docker Image (push) Successful in 12m39s
Test / Type Check (all packages) (push) Successful in 5m8s
Build & Deploy / Deploy to VPS (push) Successful in 7s
Test / API Unit Tests (push) Failing after 4m24s
Test / Homepage Unit Tests (push) Successful in 3m27s
Test / Storefront Unit Tests (push) Successful in 4m48s
Test / Admin Unit Tests (push) Successful in 3m0s
Test / Dashboard Unit Tests (push) Successful in 4m18s
Test / API Integration Tests (push) Failing after 4m34s

This commit is contained in:
root
2026-06-29 22:15:34 -04:00
parent e1e2f55c93
commit a752a399c2
30 changed files with 4503 additions and 1214 deletions
@@ -3,7 +3,17 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'
vi.mock('../../lib/prisma', () => ({
prisma: {
rentalPayment: { findMany: vi.fn(), findFirst: vi.fn(), findFirstOrThrow: vi.fn(), update: vi.fn(), updateMany: vi.fn(), create: vi.fn() },
reservation: { findFirstOrThrow: vi.fn(), update: vi.fn() },
reservation: { findFirstOrThrow: vi.fn(), update: vi.fn(), findUniqueOrThrow: vi.fn() },
$transaction: vi.fn(async (callback) => callback({
reservation: {
findUniqueOrThrow: vi.fn().mockResolvedValue({
id: 'reservation_1',
totalAmount: 5000,
rentalPayments: [{ amount: 2500 }, { amount: 1500 }],
}),
update: vi.fn(),
},
})),
},
}))
@@ -46,13 +56,10 @@ describe('payment.repo edge queries', () => {
vi.useRealTimers()
})
it('increments paid amount and promotes reservation payment status to paid', async () => {
it('recomputes paid amount from successful charge payments', async () => {
await repo.incrementReservationPaid('reservation_1', 2500)
expect(prisma.reservation.update).toHaveBeenCalledWith({
where: { id: 'reservation_1' },
data: { paymentStatus: 'PAID', paidAmount: { increment: 2500 } },
})
expect(prisma.$transaction).toHaveBeenCalled()
})
it('maps partial refunds to the correct payment status', async () => {