File tree 1 file changed +4
-5
lines changed
site/src/pages/WorkspacePage 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ import { rest } from "msw";
6
6
import {
7
7
MockTemplate ,
8
8
MockWorkspace ,
9
- MockFailedWorkspace ,
10
9
MockWorkspaceBuild ,
11
10
MockStoppedWorkspace ,
12
11
MockStartingWorkspace ,
@@ -25,6 +24,7 @@ import { WorkspacePage } from "./WorkspacePage";
25
24
26
25
// It renders the workspace page and waits for it be loaded
27
26
const renderWorkspacePage = async ( workspace : Workspace ) => {
27
+ jest . spyOn ( api , "getWorkspaceByOwnerAndName" ) . mockResolvedValue ( workspace ) ;
28
28
jest . spyOn ( api , "getTemplate" ) . mockResolvedValueOnce ( MockTemplate ) ;
29
29
jest . spyOn ( api , "getTemplateVersionRichParameters" ) . mockResolvedValueOnce ( [ ] ) ;
30
30
jest
@@ -55,15 +55,14 @@ const renderWorkspacePage = async (workspace: Workspace) => {
55
55
*/
56
56
const testButton = async (
57
57
workspace : Workspace ,
58
- label : string ,
58
+ name : string | RegExp ,
59
59
actionMock : jest . SpyInstance ,
60
60
) => {
61
- const user = userEvent . setup ( ) ;
62
61
await renderWorkspacePage ( workspace ) ;
63
-
64
62
const workspaceActions = screen . getByTestId ( "workspace-actions" ) ;
65
- const button = within ( workspaceActions ) . getByRole ( "button" , { name : label } ) ;
63
+ const button = within ( workspaceActions ) . getByRole ( "button" , { name } ) ;
66
64
65
+ const user = userEvent . setup ( ) ;
67
66
await user . click ( button ) ;
68
67
expect ( actionMock ) . toBeCalled ( ) ;
69
68
} ;
You can’t perform that action at this time.
0 commit comments