@@ -178,10 +178,12 @@ describe("WorkspacePage", () => {
178
178
} ,
179
179
) ,
180
180
) ;
181
+
181
182
const startWorkspaceMock = jest
182
183
. spyOn ( api , "startWorkspace" )
183
184
. mockImplementation ( ( ) => Promise . resolve ( MockWorkspaceBuild ) ) ;
184
- await testButton ( MockWorkspace , "Start" , startWorkspaceMock ) ;
185
+
186
+ await testButton ( MockStoppedWorkspace , "Start" , startWorkspaceMock ) ;
185
187
} ) ;
186
188
187
189
it ( "requests a stop job when the user presses Stop" , async ( ) => {
@@ -221,20 +223,12 @@ describe("WorkspacePage", () => {
221
223
} ,
222
224
) ,
223
225
) ;
226
+
224
227
const cancelWorkspaceMock = jest
225
228
. spyOn ( api , "cancelWorkspaceBuild" )
226
229
. mockImplementation ( ( ) => Promise . resolve ( { message : "job canceled" } ) ) ;
227
230
228
- await renderWorkspacePage ( MockWorkspace ) ;
229
-
230
- const workspaceActions = screen . getByTestId ( "workspace-actions" ) ;
231
- const cancelButton = within ( workspaceActions ) . getByRole ( "button" , {
232
- name : "Cancel" ,
233
- } ) ;
234
-
235
- await userEvent . click ( cancelButton ) ;
236
-
237
- expect ( cancelWorkspaceMock ) . toBeCalled ( ) ;
231
+ await testButton ( MockStartingWorkspace , "Cancel" , cancelWorkspaceMock ) ;
238
232
} ) ;
239
233
240
234
it ( "requests an update when the user presses Update" , async ( ) => {
0 commit comments