@@ -1906,5 +1906,111 @@ describe("CalendarEventBuilder", () => {
19061906
19071907 expect ( builtFromBooking . bookerUrl ) . toBe ( "https://cal.com" ) ;
19081908 } ) ;
1909+
1910+ it ( "should resolve app type to human-readable app name in appsStatus" , async ( ) => {
1911+ const mockBooking = {
1912+ uid : "booking-app-name-test" ,
1913+ metadata : null ,
1914+ title : "App Name Test Event" ,
1915+ startTime : new Date ( mockStartTime ) ,
1916+ endTime : new Date ( mockEndTime ) ,
1917+ description : null ,
1918+ location : "integrations:google:meet" ,
1919+ responses : null ,
1920+ customInputs : null ,
1921+ iCalUID : null ,
1922+ iCalSequence : 0 ,
1923+ oneTimePassword : null ,
1924+ attendees : [
1925+ {
1926+ name : "Test Attendee" ,
1927+ email : "attendee@example.com" ,
1928+ timeZone : "UTC" ,
1929+ locale : "en" ,
1930+ phoneNumber : null ,
1931+ bookingSeat : null ,
1932+ } ,
1933+ ] ,
1934+ user : {
1935+ id : 1 ,
1936+ name : "Test Host" ,
1937+ email : "host@example.com" ,
1938+ username : "testhost" ,
1939+ timeZone : "UTC" ,
1940+ locale : "en" ,
1941+ timeFormat : 24 ,
1942+ destinationCalendar : null ,
1943+ profiles : [ ] ,
1944+ } ,
1945+ destinationCalendar : null ,
1946+ eventType : {
1947+ id : 1 ,
1948+ title : "Test Event Type" ,
1949+ slug : "test-event" ,
1950+ description : null ,
1951+ hideCalendarNotes : false ,
1952+ hideCalendarEventDetails : false ,
1953+ hideOrganizerEmail : false ,
1954+ schedulingType : null ,
1955+ seatsPerTimeSlot : null ,
1956+ seatsShowAttendees : false ,
1957+ seatsShowAvailabilityCount : false ,
1958+ customReplyToEmail : null ,
1959+ disableRescheduling : false ,
1960+ disableCancelling : false ,
1961+ requiresConfirmation : false ,
1962+ recurringEvent : null ,
1963+ bookingFields : [ ] ,
1964+ metadata : null ,
1965+ eventName : null ,
1966+ team : null ,
1967+ users : [ ] ,
1968+ hosts : [ ] ,
1969+ workflows : [ ] ,
1970+ } ,
1971+ references : [
1972+ {
1973+ type : "google_calendar" ,
1974+ uid : "google-cal-uid-123" ,
1975+ meetingId : null ,
1976+ meetingPassword : null ,
1977+ meetingUrl : null ,
1978+ } ,
1979+ {
1980+ type : "google_video" ,
1981+ uid : "google-meet-uid-456" ,
1982+ meetingId : "meet-123" ,
1983+ meetingPassword : null ,
1984+ meetingUrl : "https://meet.google.com/abc-defg-hij" ,
1985+ } ,
1986+ ] ,
1987+ seatsReferences : [ ] ,
1988+ } satisfies BookingForCalEventBuilder ;
1989+
1990+ const eventFromBooking = await CalendarEventBuilder . fromBooking ( mockBooking ) ;
1991+ const builtEvent = eventFromBooking . build ( ) ;
1992+
1993+ expect ( builtEvent ) . not . toBeNull ( ) ;
1994+ if ( builtEvent ) {
1995+ expect ( builtEvent . appsStatus ) . toBeDefined ( ) ;
1996+ expect ( builtEvent . appsStatus ) . toHaveLength ( 2 ) ;
1997+
1998+ // Verify Google Calendar uses human-readable name, not the type slug
1999+ const googleCalendarStatus = builtEvent . appsStatus ?. find ( ( app ) => app . type === "google_calendar" ) ;
2000+ expect ( googleCalendarStatus ) . toBeDefined ( ) ;
2001+ expect ( googleCalendarStatus ?. appName ) . toBe ( "Google Calendar" ) ;
2002+ // Should NOT be the raw type like "google_calendar" or "google-calendar"
2003+ expect ( googleCalendarStatus ?. appName ) . not . toBe ( "google_calendar" ) ;
2004+ expect ( googleCalendarStatus ?. appName ) . not . toBe ( "google-calendar" ) ;
2005+
2006+ // Verify Google Meet uses human-readable name
2007+ const googleMeetStatus = builtEvent . appsStatus ?. find ( ( app ) => app . type === "google_video" ) ;
2008+ expect ( googleMeetStatus ) . toBeDefined ( ) ;
2009+ expect ( googleMeetStatus ?. appName ) . toBe ( "Google Meet" ) ;
2010+ // Should NOT be the raw type
2011+ expect ( googleMeetStatus ?. appName ) . not . toBe ( "google_video" ) ;
2012+ expect ( googleMeetStatus ?. appName ) . not . toBe ( "google-video" ) ;
2013+ }
2014+ } ) ;
19092015 } ) ;
19102016} ) ;
0 commit comments