import {
  CancellationFlow,
  TrainSearchModalUtil,
  TrainTripType,
  AmtrakBookingParams,
  TrainBookingManager
} from '@train-lib/index';

describe('Train: Amtrak roundtrip cancellation workflow', () => {
  it(
    'C48361: Should be able to book and cancel a round train ticket',
    { tags: ['@amtrak', '@all_train_test'] },
    () => {
      const tripType = TrainTripType.ROUND_TRIP;

      const createBooking = () => {
        TrainBookingManager.createFirstClassBooking({
          origin: AmtrakBookingParams.Location.NewYork,
          destination: AmtrakBookingParams.Location.Washington,
          trainClass: true,
          fareType: AmtrakBookingParams.FareType.FIRST_CLASS,
          tripType: tripType
        });
      };

      TrainSearchModalUtil.createCompanyWithProviderName({});
      createBooking();
      CancellationFlow.executeTrainCancellation(
        'We advise you to print your e-ticket(s) for this route.',
        tripType
      );
    }
  );
});
