1
1
import { bootstrap } from "@/app" ;
2
2
import { AppModule } from "@/app.module" ;
3
- import { CreateScheduleInput } from "@/ee/schedules/inputs/create-schedule.input" ;
4
- import { CreateScheduleOutput } from "@/ee/schedules/outputs/create-schedule.output" ;
5
- import { GetSchedulesOutput } from "@/ee/schedules/outputs/get-schedules.output" ;
6
- import { UpdateScheduleOutput } from "@/ee/schedules/outputs/update-schedule.output" ;
7
- import { SchedulesModule } from "@/ee/schedules/schedules.module" ;
3
+ import { CreateScheduleInput_2024_04_15 } from "@/ee/schedules/schedules_2024_04_15 /inputs/create-schedule.input" ;
4
+ import { CreateScheduleOutput_2024_04_15 } from "@/ee/schedules/schedules_2024_04_15 /outputs/create-schedule.output" ;
5
+ import { GetSchedulesOutput_2024_04_15 } from "@/ee/schedules/schedules_2024_04_15 /outputs/get-schedules.output" ;
6
+ import { UpdateScheduleOutput_2024_04_15 } from "@/ee/schedules/schedules_2024_04_15 /outputs/update-schedule.output" ;
7
+ import { SchedulesModule_2024_04_15 } from "@/ee/schedules/schedules_2024_04_15 /schedules.module" ;
8
8
import { PermissionsGuard } from "@/modules/auth/guards/permissions/permissions.guard" ;
9
- import { AvailabilitiesModule } from "@/modules/availabilities/availabilities.module" ;
10
9
import { PrismaModule } from "@/modules/prisma/prisma.module" ;
11
10
import { TokensModule } from "@/modules/tokens/tokens.module" ;
12
11
import { UsersModule } from "@/modules/users/users.module" ;
@@ -19,8 +18,8 @@ import { SchedulesRepositoryFixture } from "test/fixtures/repository/schedules.r
19
18
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture" ;
20
19
import { withAccessTokenAuth } from "test/utils/withAccessTokenAuth" ;
21
20
22
- import { SUCCESS_STATUS } from "@calcom/platform-constants" ;
23
- import { UpdateScheduleInput } from "@calcom/platform-types" ;
21
+ import { CAL_API_VERSION_HEADER , SUCCESS_STATUS , VERSION_2024_04_15 } from "@calcom/platform-constants" ;
22
+ import { UpdateScheduleInput_2024_04_15 } from "@calcom/platform-types" ;
24
23
25
24
describe ( "Schedules Endpoints" , ( ) => {
26
25
describe ( "User Authentication" , ( ) => {
@@ -32,7 +31,7 @@ describe("Schedules Endpoints", () => {
32
31
const userEmail = "schedules-controller-e2e@api.com" ;
33
32
let user : User ;
34
33
35
- let createdSchedule : CreateScheduleOutput [ "data" ] ;
34
+ let createdSchedule : CreateScheduleOutput_2024_04_15 [ "data" ] ;
36
35
const defaultAvailabilityDays = [ 1 , 2 , 3 , 4 , 5 ] ;
37
36
const defaultAvailabilityStartTime = "1970-01-01T09:00:00.000Z" ;
38
37
const defaultAvailabilityEndTime = "1970-01-01T17:00:00.000Z" ;
@@ -41,14 +40,7 @@ describe("Schedules Endpoints", () => {
41
40
const moduleRef = await withAccessTokenAuth (
42
41
userEmail ,
43
42
Test . createTestingModule ( {
44
- imports : [
45
- AppModule ,
46
- PrismaModule ,
47
- AvailabilitiesModule ,
48
- UsersModule ,
49
- TokensModule ,
50
- SchedulesModule ,
51
- ] ,
43
+ imports : [ AppModule , PrismaModule , UsersModule , TokensModule , SchedulesModule_2024_04_15 ] ,
52
44
} )
53
45
)
54
46
. overrideGuard ( PermissionsGuard )
@@ -79,18 +71,19 @@ describe("Schedules Endpoints", () => {
79
71
const scheduleTimeZone = "Europe/Rome" ;
80
72
const isDefault = true ;
81
73
82
- const body : CreateScheduleInput = {
74
+ const body : CreateScheduleInput_2024_04_15 = {
83
75
name : scheduleName ,
84
76
timeZone : scheduleTimeZone ,
85
77
isDefault,
86
78
} ;
87
79
88
80
return request ( app . getHttpServer ( ) )
89
81
. post ( "/api/v2/schedules" )
82
+ . set ( CAL_API_VERSION_HEADER , VERSION_2024_04_15 )
90
83
. send ( body )
91
84
. expect ( 201 )
92
85
. then ( async ( response ) => {
93
- const responseData : CreateScheduleOutput = response . body ;
86
+ const responseData : CreateScheduleOutput_2024_04_15 = response . body ;
94
87
expect ( responseData . status ) . toEqual ( SUCCESS_STATUS ) ;
95
88
expect ( responseData . data ) . toBeDefined ( ) ;
96
89
expect ( responseData . data . isDefault ) . toEqual ( isDefault ) ;
@@ -117,7 +110,7 @@ describe("Schedules Endpoints", () => {
117
110
. get ( "/api/v2/schedules/default" )
118
111
. expect ( 200 )
119
112
. then ( async ( response ) => {
120
- const responseData : CreateScheduleOutput = response . body ;
113
+ const responseData : CreateScheduleOutput_2024_04_15 = response . body ;
121
114
expect ( responseData . status ) . toEqual ( SUCCESS_STATUS ) ;
122
115
expect ( responseData . data ) . toBeDefined ( ) ;
123
116
expect ( responseData . data . id ) . toEqual ( createdSchedule . id ) ;
@@ -137,7 +130,7 @@ describe("Schedules Endpoints", () => {
137
130
. get ( `/api/v2/schedules` )
138
131
. expect ( 200 )
139
132
. then ( ( response ) => {
140
- const responseData : GetSchedulesOutput = response . body ;
133
+ const responseData : GetSchedulesOutput_2024_04_15 = response . body ;
141
134
expect ( responseData . status ) . toEqual ( SUCCESS_STATUS ) ;
142
135
expect ( responseData . data ) . toBeDefined ( ) ;
143
136
expect ( responseData . data ?. [ 0 ] . id ) . toEqual ( createdSchedule . id ) ;
@@ -155,16 +148,17 @@ describe("Schedules Endpoints", () => {
155
148
it ( "should update schedule name" , async ( ) => {
156
149
const newScheduleName = "new-schedule-name" ;
157
150
158
- const body : UpdateScheduleInput = {
151
+ const body : UpdateScheduleInput_2024_04_15 = {
159
152
name : newScheduleName ,
160
153
} ;
161
154
162
155
return request ( app . getHttpServer ( ) )
163
156
. patch ( `/api/v2/schedules/${ createdSchedule . id } ` )
157
+ . set ( CAL_API_VERSION_HEADER , VERSION_2024_04_15 )
164
158
. send ( body )
165
159
. expect ( 200 )
166
160
. then ( ( response : any ) => {
167
- const responseData : UpdateScheduleOutput = response . body ;
161
+ const responseData : UpdateScheduleOutput_2024_04_15 = response . body ;
168
162
expect ( responseData . status ) . toEqual ( SUCCESS_STATUS ) ;
169
163
expect ( responseData . data ) . toBeDefined ( ) ;
170
164
expect ( responseData . data . schedule . name ) . toEqual ( newScheduleName ) ;
0 commit comments