@@ -53,8 +53,10 @@ describe("Bookings Endpoints 2024-08-13", () => {
5353 let apiKeyString : string ;
5454
5555 let seatedEventTypeId : number ;
56+ let seatedEventTypeIdAttendeesDisabledId : number ;
5657
5758 const seatedEventSlug = `seated-bookings-event-type-${ randomString ( ) } ` ;
59+ const seatedEventSlugAttendeesDisabled = `seated-bookings-event-type-attendees-disabled-${ randomString ( ) } ` ;
5860
5961 let createdSeatedBooking : CreateSeatedBookingOutput_2024_08_13 ;
6062 let createdSeatedBooking2 : CreateSeatedBookingOutput_2024_08_13 ;
@@ -121,6 +123,28 @@ describe("Bookings Endpoints 2024-08-13", () => {
121123 ) ;
122124 seatedEventTypeId = seatedEvent . id ;
123125
126+ const seatedEventAttendeesDisabled = await eventTypesRepositoryFixture . create (
127+ {
128+ title : `seated-bookings-2024-08-13-event-type-attendees-disabled-${ randomString ( ) } ` ,
129+ slug : seatedEventSlugAttendeesDisabled ,
130+ length : 60 ,
131+ seatsPerTimeSlot : 5 ,
132+ seatsShowAttendees : false ,
133+ seatsShowAvailabilityCount : false ,
134+ locations : [ { type : "inPerson" , address : "via 10, rome, italy" } ] ,
135+ metadata : {
136+ disableStandardEmails : {
137+ all : {
138+ attendee : true ,
139+ host : true ,
140+ } ,
141+ } ,
142+ } ,
143+ } ,
144+ user . id
145+ ) ;
146+ seatedEventTypeIdAttendeesDisabledId = seatedEventAttendeesDisabled . id ;
147+
124148 app = moduleRef . createNestApplication ( ) ;
125149 bootstrap ( app as NestExpressApplication ) ;
126150
@@ -414,6 +438,63 @@ describe("Bookings Endpoints 2024-08-13", () => {
414438 } ) ;
415439 } ) ;
416440
441+ it ( "should book an event type with attendees disabled" , async ( ) => {
442+ const body : CreateBookingInput_2024_08_13 = {
443+ start : new Date ( Date . UTC ( 2030 , 0 , 9 , 14 , 0 , 0 ) ) . toISOString ( ) ,
444+ eventTypeId : seatedEventTypeIdAttendeesDisabledId ,
445+ attendee : {
446+ name : nameAttendeeOne ,
447+ email : emailAttendeeOne ,
448+ timeZone : "Europe/Rome" ,
449+ language : "it" ,
450+ } ,
451+ bookingFieldsResponses : {
452+ codingLanguage : "TypeScript" ,
453+ } ,
454+ metadata : {
455+ userId : "100" ,
456+ } ,
457+ } ;
458+
459+ return request ( app . getHttpServer ( ) )
460+ . post ( "/v2/bookings" )
461+ . send ( body )
462+ . set ( CAL_API_VERSION_HEADER , VERSION_2024_08_13 )
463+ . expect ( 201 )
464+ . then ( async ( response ) => {
465+ const responseBody : CreateBookingOutput_2024_08_13 = response . body ;
466+ expect ( responseBody . status ) . toEqual ( SUCCESS_STATUS ) ;
467+ expect ( responseBody . data ) . toBeDefined ( ) ;
468+ expect ( responseDataIsCreateSeatedBooking ( responseBody . data ) ) . toBe ( true ) ;
469+
470+ if ( responseDataIsCreateSeatedBooking ( responseBody . data ) ) {
471+ const data : CreateSeatedBookingOutput_2024_08_13 = responseBody . data ;
472+ expect ( data . seatUid ) . toBeDefined ( ) ;
473+ expect ( data . id ) . toBeDefined ( ) ;
474+ expect ( data . uid ) . toBeDefined ( ) ;
475+ expect ( data . hosts [ 0 ] . id ) . toEqual ( user . id ) ;
476+ expect ( data . status ) . toEqual ( "accepted" ) ;
477+ expect ( data . start ) . toEqual ( body . start ) ;
478+ expect ( data . end ) . toEqual (
479+ DateTime . fromISO ( body . start , { zone : "utc" } ) . plus ( { hours : 1 } ) . toISO ( )
480+ ) ;
481+ expect ( data . duration ) . toEqual ( 60 ) ;
482+ expect ( data . eventTypeId ) . toEqual ( seatedEventTypeIdAttendeesDisabledId ) ;
483+ expect ( data . eventType ) . toEqual ( {
484+ id : seatedEventTypeIdAttendeesDisabledId ,
485+ slug : seatedEventSlugAttendeesDisabled ,
486+ } ) ;
487+ expect ( data . attendees . length ) . toEqual ( 0 ) ;
488+ expect ( data . location ) . toBeDefined ( ) ;
489+ expect ( data . absentHost ) . toEqual ( false ) ;
490+ } else {
491+ throw new Error (
492+ "Invalid response data - expected seated booking but received non array response"
493+ ) ;
494+ }
495+ } ) ;
496+ } ) ;
497+
417498 describe ( "cancel seated booking" , ( ) => {
418499 describe ( "cancel seated booking as attendee" , ( ) => {
419500 it ( "should cancel seated booking" , async ( ) => {
0 commit comments