fix tests issue
This commit is contained in:
@@ -228,7 +228,7 @@ describe('checkinReservation', () => {
|
||||
|
||||
// ────────────────────────────────────────────────────────────────────────────
|
||||
describe('checkoutReservation', () => {
|
||||
it('transitions ACTIVE → COMPLETED and marks vehicle AVAILABLE', async () => {
|
||||
it('transitions ACTIVE → COMPLETED and marks vehicle RETURNED', async () => {
|
||||
const res = makeReservation({ status: 'ACTIVE' })
|
||||
vi.mocked(repo.findByIdForCheckout).mockResolvedValue(res as any)
|
||||
vi.mocked(repo.updateById).mockResolvedValue({ ...res, status: 'COMPLETED' } as any)
|
||||
@@ -239,7 +239,7 @@ describe('checkoutReservation', () => {
|
||||
await checkoutReservation(RES_ID, COMPANY, 58000)
|
||||
|
||||
expect(repo.updateById).toHaveBeenCalledWith(RES_ID, expect.objectContaining({ status: 'COMPLETED', checkOutMileage: 58000 }))
|
||||
expect(repo.updateVehicleStatus).toHaveBeenCalledWith('vehicle-1', 'AVAILABLE', 58000)
|
||||
expect(repo.updateVehicleStatus).toHaveBeenCalledWith('vehicle-1', 'RETURNED', 58000)
|
||||
})
|
||||
|
||||
it('rejects non-ACTIVE reservation', async () => {
|
||||
|
||||
Reference in New Issue
Block a user