UNPKG

qe-fe-automation

Version:
91 lines (85 loc) 2.98 kB
import { GuestInvite } from '@admin-factory/interface'; import { faker } from '@faker-js/faker'; import { Dates, LocationUtility } from '@utility-lib/index'; export function createCarGuestInvite(): GuestInvite { const guestInviteLocation = LocationUtility.getAirportUSWithLocationId(); const rentalCarGuestInvite = { invitees: [ { givenName: faker.name.firstName(), familyName: faker.name.lastName().replace(/'/g, ''), email: '', billTo: 'Not Applicable', department: 'Not Applicable' } ], tripInvitation: { extraGuestAllowed: false, purpose: `CarEvent-${faker.datatype.number({ min: 10000000 })}`, location: guestInviteLocation.location, customBookingWindowDays: null, hasCustomBookingWindow: false, hotelRestrictions: false, returnFlightTimeLocked: false, destinationAirport: '', flightBookingAllowed: false, flightBookingInstructions: '', flightMaxPriceLocale: '', recommendedHotels: [], hotelBookingAllowed: false, hotelBookingInstructions: '', hotelMaxPriceLocale: '', railBookingAllowed: false, railBookingInstructions: '', railMaxPriceLocale: '', carRentalCompanyName: '', carBookingAllowed: true, carBookingInstructions: '', carMaxPriceLocale: '', flightItineraryType: [], railItineraryType: [], generalInstructions: '', companyPaymentMethodUuid: '', hotelRateTypes: ['PAY_NOW'], startDateTime: Dates.getDateTime(32).slice(0, 10).concat('T12:00'), endDateTime: Dates.getDateTime(34).slice(0, 10).concat('T12:00'), travelEarliestDepartureDateTime: Dates.getDateTime(31) .slice(0, 10) .concat('T12:00'), travelLatestReturningDateTime: Dates.getDateTime(35).slice(0, 10).concat('T12:00'), contact: { uuid: '' }, flightMaxPrice: 0, railMaxPrice: 0, hotelMaxPrice: 0, carMaxPrice: 0, locationGooglePlaceId: guestInviteLocation.locationGoogleId, billTo: '', department: '', reminderEmailConfig: { repeatEveryDays: null, remindBeforeDays: null }, companyPolicyLevel: { level: 'DEFAULT', mediumHaulEnabled: true, name: 'DEFAULT', uuid: '' }, companyCarDirectBillPaymentMethods: [], customFieldValues: [] } }; cy.task('getDataFromCache', 'userResponse').then((response: any) => { rentalCarGuestInvite.tripInvitation.contact.uuid = response.uuid; rentalCarGuestInvite.tripInvitation.companyPolicyLevel.uuid = response.companyPolicyLevel.uuid; rentalCarGuestInvite.invitees[0].email = response.email; }); cy.task('getDataFromCache', 'paymentMethod').then((paymentMethodResponse: any) => { rentalCarGuestInvite.tripInvitation.companyPaymentMethodUuid = paymentMethodResponse.uuid; }); return rentalCarGuestInvite; }