25 lines
997 B
TypeScript
25 lines
997 B
TypeScript
import { CsvBookingService } from './csv-booking.service';
|
|
import { CsvBooking } from '@domain/entities/csv-booking.entity';
|
|
|
|
describe('customer booking response', () => {
|
|
it('omits carrier capabilities while preserving booking information', () => {
|
|
const booking = {
|
|
id: 'booking-1',
|
|
primaryCurrency: 'EUR',
|
|
confirmationToken: 'carrier-secret',
|
|
origin: { getValue: () => 'FRLEH' },
|
|
destination: { getValue: () => 'CNSHA' },
|
|
documents: [],
|
|
getRouteDescription: () => 'FRLEH → CNSHA',
|
|
isExpired: () => false,
|
|
getPriceInCurrency: () => 100,
|
|
} as unknown as CsvBooking;
|
|
const service = Object.create(CsvBookingService.prototype) as CsvBookingService;
|
|
const response = service['toResponseDto'](booking);
|
|
expect(response.id).toBe('booking-1');
|
|
expect(response.price).toBe(100);
|
|
expect(response).not.toHaveProperty('confirmationToken');
|
|
expect(JSON.stringify(response)).not.toContain('carrier-secret');
|
|
});
|
|
});
|