@@ -24,7 +24,12 @@ import { TeamRepositoryFixture } from "test/fixtures/repository/team.repository.
24
24
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture" ;
25
25
import { withApiAuth } from "test/utils/withApiAuth" ;
26
26
27
- import { SUCCESS_STATUS } from "@calcom/platform-constants" ;
27
+ import {
28
+ SUCCESS_STATUS ,
29
+ VERSION_2024_06_11 ,
30
+ VERSION_2024_04_15 ,
31
+ CAL_API_VERSION_HEADER ,
32
+ } from "@calcom/platform-constants" ;
28
33
import {
29
34
EventTypesByViewer ,
30
35
EventTypesPublic ,
@@ -154,6 +159,7 @@ describe("Event types Endpoints", () => {
154
159
155
160
return request ( app . getHttpServer ( ) )
156
161
. post ( "/api/v2/event-types" )
162
+ . set ( CAL_API_VERSION_HEADER , VERSION_2024_04_15 )
157
163
. send ( body )
158
164
. expect ( 201 )
159
165
. then ( async ( response ) => {
@@ -184,6 +190,7 @@ describe("Event types Endpoints", () => {
184
190
185
191
return request ( app . getHttpServer ( ) )
186
192
. patch ( `/api/v2/event-types/${ eventType . id } ` )
193
+ . set ( CAL_API_VERSION_HEADER , VERSION_2024_04_15 )
187
194
. send ( body )
188
195
. expect ( 200 )
189
196
. then ( async ( response ) => {
@@ -288,6 +295,25 @@ describe("Event types Endpoints", () => {
288
295
it ( `/GET/:id` , async ( ) => {
289
296
const response = await request ( app . getHttpServer ( ) )
290
297
. get ( `/api/v2/event-types/${ eventType . id } ` )
298
+ . set ( CAL_API_VERSION_HEADER , VERSION_2024_04_15 )
299
+ // note: bearer token value mocked using "withApiAuth" for user which id is used when creating event type above
300
+ . set ( "Authorization" , `Bearer whatever` )
301
+ . expect ( 200 ) ;
302
+
303
+ const responseBody : GetEventTypeOutput = response . body ;
304
+
305
+ expect ( responseBody . status ) . toEqual ( SUCCESS_STATUS ) ;
306
+ expect ( responseBody . data ) . toBeDefined ( ) ;
307
+ expect ( responseBody . data . eventType . id ) . toEqual ( eventType . id ) ;
308
+ expect ( responseBody . data . eventType . title ) . toEqual ( eventType . title ) ;
309
+ expect ( responseBody . data . eventType . slug ) . toEqual ( eventType . slug ) ;
310
+ expect ( responseBody . data . eventType . userId ) . toEqual ( user . id ) ;
311
+ } ) ;
312
+
313
+ it ( `/GET/:id with version VERSION_2024_06_11` , async ( ) => {
314
+ const response = await request ( app . getHttpServer ( ) )
315
+ . get ( `/api/v2/event-types/${ eventType . id } ` )
316
+ . set ( CAL_API_VERSION_HEADER , VERSION_2024_06_11 )
291
317
// note: bearer token value mocked using "withApiAuth" for user which id is used when creating event type above
292
318
. set ( "Authorization" , `Bearer whatever` )
293
319
. expect ( 200 ) ;
@@ -305,6 +331,7 @@ describe("Event types Endpoints", () => {
305
331
it ( `/GET/:username/public` , async ( ) => {
306
332
const response = await request ( app . getHttpServer ( ) )
307
333
. get ( `/api/v2/event-types/${ username } /public` )
334
+ . set ( CAL_API_VERSION_HEADER , VERSION_2024_04_15 )
308
335
// note: bearer token value mocked using "withApiAuth" for user which id is used when creating event type above
309
336
. set ( "Authorization" , `Bearer whatever` )
310
337
. expect ( 200 ) ;
@@ -323,6 +350,7 @@ describe("Event types Endpoints", () => {
323
350
it ( `/GET/:username/:eventSlug/public` , async ( ) => {
324
351
const response = await request ( app . getHttpServer ( ) )
325
352
. get ( `/api/v2/event-types/${ username } /${ eventType . slug } /public` )
353
+ . set ( CAL_API_VERSION_HEADER , VERSION_2024_04_15 )
326
354
// note: bearer token value mocked using "withApiAuth" for user which id is used when creating event type above
327
355
. set ( "Authorization" , `Bearer whatever` )
328
356
. expect ( 200 ) ;
@@ -340,6 +368,7 @@ describe("Event types Endpoints", () => {
340
368
it ( `/GET/` , async ( ) => {
341
369
const response = await request ( app . getHttpServer ( ) )
342
370
. get ( `/api/v2/event-types` )
371
+ . set ( CAL_API_VERSION_HEADER , VERSION_2024_04_15 )
343
372
// note: bearer token value mocked using "withApiAuth" for user which id is used when creating event type above
344
373
. set ( "Authorization" , `Bearer whatever` )
345
374
. expect ( 200 ) ;
@@ -359,6 +388,7 @@ describe("Event types Endpoints", () => {
359
388
it ( `/GET/public/:username/` , async ( ) => {
360
389
const response = await request ( app . getHttpServer ( ) )
361
390
. get ( `/api/v2/event-types/${ username } /public` )
391
+ . set ( CAL_API_VERSION_HEADER , VERSION_2024_04_15 )
362
392
// note: bearer token value mocked using "withApiAuth" for user which id is used when creating event type above
363
393
. set ( "Authorization" , `Bearer whatever` )
364
394
. expect ( 200 ) ;
@@ -375,13 +405,17 @@ describe("Event types Endpoints", () => {
375
405
it ( `/GET/:id not existing` , async ( ) => {
376
406
await request ( app . getHttpServer ( ) )
377
407
. get ( `/api/v2/event-types/1000` )
408
+ . set ( CAL_API_VERSION_HEADER , VERSION_2024_04_15 )
378
409
// note: bearer token value mocked using "withApiAuth" for user which id is used when creating event type above
379
410
. set ( "Authorization" , `Bearer whatever` )
380
411
. expect ( 404 ) ;
381
412
} ) ;
382
413
383
414
it ( "should delete schedule" , async ( ) => {
384
- return request ( app . getHttpServer ( ) ) . delete ( `/api/v2/event-types/${ eventType . id } ` ) . expect ( 200 ) ;
415
+ return request ( app . getHttpServer ( ) )
416
+ . delete ( `/api/v2/event-types/${ eventType . id } ` )
417
+ . set ( CAL_API_VERSION_HEADER , VERSION_2024_04_15 )
418
+ . expect ( 200 ) ;
385
419
} ) ;
386
420
387
421
afterAll ( async ( ) => {
0 commit comments