UNPKG

qe-fe-automation

Version:
88 lines (82 loc) 2.86 kB
import { GuestInvite } from '@admin-factory/interface'; import { faker } from '@faker-js/faker'; import { Dates } from '@utility-lib/dates'; export function createFlightGuestInvite(): GuestInvite { const guestInvite = { invitees: [ { givenName: faker.name.firstName(), familyName: faker.name.lastName().replace(/'/g, ''), email: '', billTo: 'Not Applicable', department: 'Not Applicable' } ], tripInvitation: { extraGuestAllowed: false, purpose: `FlightEvent-${faker.datatype.number({ min: 10000000 })}`, location: 'San Francisco International Airport (SFO), San Francisco, CA, USA', customBookingWindowDays: null, hasCustomBookingWindow: false, hotelRestrictions: false, returnFlightTimeLocked: false, destinationAirport: '', flightBookingAllowed: true, flightBookingInstructions: '', flightMaxPriceLocale: '', recommendedHotels: [], hotelBookingAllowed: false, hotelBookingInstructions: '', hotelMaxPriceLocale: '', railBookingAllowed: false, railBookingInstructions: '', railMaxPriceLocale: '', carRentalCompanyName: '', carBookingAllowed: false, 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: 'ChIJVVVVVYx3j4ARP-3NGldc8qQ', billTo: '', department: '', reminderEmailConfig: { repeatEveryDays: null, remindBeforeDays: null }, companyPolicyLevel: { uuid: '', level: 'DEFAULT', mediumHaulEnabled: true, name: 'DEFAULT' }, companyCarDirectBillPaymentMethods: [], customFieldValues: [] } }; cy.task('getDataFromCache', 'userResponse').then((response: any) => { guestInvite.tripInvitation.contact.uuid = response.uuid; guestInvite.tripInvitation.companyPolicyLevel.uuid = response.companyPolicyLevel.uuid; guestInvite.invitees[0].email = response.email; }); cy.task('getDataFromCache', 'paymentMethod').then((paymentMethodResponse: any) => { guestInvite.tripInvitation.companyPaymentMethodUuid = paymentMethodResponse.uuid; }); return guestInvite; }