MCPcopy Index your code
hub / github.com/coder/coder / testButton

Function testButton

site/src/pages/WorkspacePage/WorkspacePage.test.tsx:75–87  ·  view source on GitHub ↗
(
	workspace: Workspace,
	name: string | RegExp,
	actionMock: MockInstance,
)

Source from the content-addressed store, hash-verified

73 * enough to prove that the workspaceStatus was calculated correctly.
74 */
75const testButton = async (
76 workspace: Workspace,
77 name: string | RegExp,
78 actionMock: MockInstance,
79) => {
80 await renderWorkspacePage(workspace);
81 const workspaceActions = screen.getByTestId("workspace-actions");
82 const button = within(workspaceActions).getByRole("button", { name });
83
84 const user = userEvent.setup();
85 await user.click(button);
86 expect(actionMock).toHaveBeenCalled();
87};
88
89afterEach(() => {
90 MockServerSocket.clean();

Callers 1

Calls 1

renderWorkspacePageFunction · 0.85

Tested by

no test coverage detected