import { historyDtoMock } from '../../../shared/mockdata';
import { HistoryDTO } from '@cmf/trade-api';
import { historyDtoToInfoText } from './history-dto-to-info-text.mapping';

fdescribe('Mapping: historyDtoToInfoText', () => {
  const historyMock: HistoryDTO = historyDtoMock;

  it('should return a string containing the date, time and location', () => {
    const result = historyDtoToInfoText(historyMock);
    const expected = `02.07.2020 | 10:56 Uhr | München Neuhausen`;

    expect(result).toEqual(expected);
  });

  it('should only return a string containing date and tiem if no location is present', () => {
    const { location, ...historyMockWithoutLocation } = historyMock;

    const result = historyDtoToInfoText(historyMockWithoutLocation);
    const expected = `02.07.2020 | 10:56 Uhr`;

    expect(result).toEqual(expected);
  });
});
