Skip to content

Commit 936c21e

Browse files
committed
chore: add test for presence of showOrganizations context value
1 parent bfdfd38 commit 936c21e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

site/src/pages/WorkspacesPage/WorkspacesPageView.stories.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
} from "testHelpers/entities";
2323
import { withDashboardProvider } from "testHelpers/storybook";
2424
import { WorkspacesPageView } from "./WorkspacesPageView";
25+
import { expect, within } from "@storybook/test";
2526

2627
const createWorkspace = (
2728
status: WorkspaceStatus,
@@ -265,3 +266,30 @@ export const InvalidPageNumber: Story = {
265266
page: 1000,
266267
},
267268
};
269+
270+
export const ShowOrganizations: Story = {
271+
args: {
272+
workspaces: [
273+
{
274+
...MockWorkspace,
275+
organization_name: "Limbus Co.",
276+
},
277+
],
278+
},
279+
280+
parameters: {
281+
showOrganizations: true,
282+
},
283+
284+
play: async ({ canvasElement }) => {
285+
const canvas = within(canvasElement);
286+
const accessibleTableCell = await canvas.findByRole("cell", {
287+
// Need whitespace classes because different parts of the element
288+
// are going in different spans, and Storybook doesn't consolidate
289+
// these
290+
name: /org\s?(?:anization)?\s?:\s?Limbus Co\./i,
291+
});
292+
293+
expect(accessibleTableCell).toBeDefined();
294+
},
295+
};

0 commit comments

Comments
 (0)