import { describe, it, expect } from 'vitest'
import { serializeReservationForDashboard } from './reservation.presenter'

describe('serializeReservationForDashboard', () => {
  it('rewrites customer license image URLs to the protected route', () => {
    const result = serializeReservationForDashboard({
      id: 'reservation-1',
      status: 'CONFIRMED',
      contractNumber: null,
      invoiceNumber: null,
      extras: {},
      customer: {
        id: 'customer-1',
        licenseImageUrl: 'http://localhost:4000/storage/companies/company-1/customers/customer-1/license.jpg',
      },
    })

    expect(result.customer?.licenseImageUrl).toBe('http://localhost:3000/dashboard/api/v1/customers/customer-1/license-image')
  })
})
