@@ -54,8 +54,8 @@ jest.mock("next/cache", () => ({
5454 updateTag : jest . fn ( ) ,
5555} ) ) ;
5656
57- const COACH_A = "11111111-1111-1111-1111-111111111111" ;
58- const COACH_B = "22222222-2222-2222-2222-222222222222" ;
57+ const COORDINATOR_A = "11111111-1111-1111-1111-111111111111" ;
58+ const COORDINATOR_B = "22222222-2222-2222-2222-222222222222" ;
5959const SERVICE_ID = "33333333-3333-3333-3333-333333333333" ;
6060
6161function fd ( obj : Record < string , string > ) : FormData {
@@ -75,7 +75,7 @@ beforeEach(() => {
7575} ) ;
7676
7777describe ( "createService" , ( ) => {
78- it ( "rejects a private lesson without a coach " , async ( ) => {
78+ it ( "rejects a private lesson without a coordinator " , async ( ) => {
7979 const result = await createService (
8080 null ,
8181 fd ( {
@@ -87,12 +87,12 @@ describe("createService", () => {
8787 } ) ,
8888 ) ;
8989
90- expect ( result ?. errors ?. coach_id ) . toBeDefined ( ) ;
90+ expect ( result ?. errors ?. coordinator_id ) . toBeDefined ( ) ;
9191 expect ( insert ) . not . toHaveBeenCalled ( ) ;
9292 expect ( createProduct ) . not . toHaveBeenCalled ( ) ;
9393 } ) ;
9494
95- it ( "persists the coach when creating a private lesson" , async ( ) => {
95+ it ( "persists the coordinator when creating a private lesson" , async ( ) => {
9696 const result = await createService (
9797 null ,
9898 fd ( {
@@ -101,18 +101,21 @@ describe("createService", () => {
101101 type : "private_lessons" ,
102102 duration_minutes : "60" ,
103103 price_cad : "50.00" ,
104- coach_id : COACH_A ,
105104 requires_subscription : "true" ,
105+ coordinator_id : COORDINATOR_A ,
106106 } ) ,
107107 ) ;
108108
109109 expect ( result ) . toEqual ( { message : "Service created." } ) ;
110110 expect ( insertValues ) . toHaveBeenCalledWith (
111- expect . objectContaining ( { type : "private_lessons" , coachId : COACH_A } ) ,
111+ expect . objectContaining ( {
112+ type : "private_lessons" ,
113+ coordinatorId : COORDINATOR_A ,
114+ } ) ,
112115 ) ;
113116 } ) ;
114117
115- it ( "creates a program with no coach " , async ( ) => {
118+ it ( "creates a program with no coordinator " , async ( ) => {
116119 const result = await createService (
117120 null ,
118121 fd ( {
@@ -130,13 +133,13 @@ describe("createService", () => {
130133
131134 expect ( result ) . toEqual ( { message : "Service created." } ) ;
132135 expect ( insertValues ) . toHaveBeenCalledWith (
133- expect . objectContaining ( { type : "programs" , coachId : null } ) ,
136+ expect . objectContaining ( { type : "programs" , coordinatorId : null } ) ,
134137 ) ;
135138 } ) ;
136139} ) ;
137140
138141describe ( "updateService" , ( ) => {
139- it ( "reassigns the coach on a private lesson" , async ( ) => {
142+ it ( "reassigns the coordinator on a private lesson" , async ( ) => {
140143 selectLimit . mockResolvedValue ( [
141144 {
142145 id : SERVICE_ID ,
@@ -148,12 +151,12 @@ describe("updateService", () => {
148151
149152 const result = await updateService (
150153 null ,
151- fd ( { service_id : SERVICE_ID , coach_id : COACH_B } ) ,
154+ fd ( { service_id : SERVICE_ID , coordinator_id : COORDINATOR_B } ) ,
152155 ) ;
153156
154157 expect ( result ) . toEqual ( { message : "Service updated." } ) ;
155158 expect ( updateSet ) . toHaveBeenCalledWith (
156- expect . objectContaining ( { coachId : COACH_B } ) ,
159+ expect . objectContaining ( { coordinatorId : COORDINATOR_B } ) ,
157160 ) ;
158161 } ) ;
159162
@@ -170,7 +173,11 @@ describe("updateService", () => {
170173
171174 const result = await updateService (
172175 null ,
173- fd ( { service_id : SERVICE_ID , coach_id : COACH_B , price_cad : "50.00" } ) ,
176+ fd ( {
177+ service_id : SERVICE_ID ,
178+ coordinator_id : COORDINATOR_B ,
179+ price_cad : "50.00" ,
180+ } ) ,
174181 ) ;
175182
176183 expect ( result ) . toEqual ( { message : "Service updated." } ) ;
@@ -199,7 +206,7 @@ describe("updateService", () => {
199206 expect ( createPrice ) . toHaveBeenCalledWith ( "prod_1" , 7500 ) ;
200207 } ) ;
201208
202- it ( "rejects clearing the coach on a private lesson" , async ( ) => {
209+ it ( "rejects clearing the coordinator on a private lesson" , async ( ) => {
203210 selectLimit . mockResolvedValue ( [
204211 {
205212 id : SERVICE_ID ,
@@ -211,10 +218,10 @@ describe("updateService", () => {
211218
212219 const result = await updateService (
213220 null ,
214- fd ( { service_id : SERVICE_ID , coach_id : "" } ) ,
221+ fd ( { service_id : SERVICE_ID , coordinator_id : "" } ) ,
215222 ) ;
216223
217- expect ( result ?. errors ?. coach_id ) . toBeDefined ( ) ;
224+ expect ( result ?. errors ?. coordinator_id ) . toBeDefined ( ) ;
218225 expect ( updateSet ) . not . toHaveBeenCalled ( ) ;
219226 } ) ;
220227} ) ;
0 commit comments