Skip to content

Commit e75e179

Browse files
committed
feat: add stories for IdpOrgSyncPageview
1 parent fe17b1c commit e75e179

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import type { Meta, StoryObj } from "@storybook/react";
2+
import { expect, userEvent, within } from "@storybook/test";
3+
import {
4+
MockOrganization,
5+
MockOrganization2,
6+
MockOrganizationSyncSettings,
7+
MockOrganizationSyncSettings2,
8+
} from "testHelpers/entities";
9+
import { IdpOrgSyncPageView } from "./IdpOrgSyncPageView";
10+
11+
const meta: Meta<typeof IdpOrgSyncPageView> = {
12+
title: "pages/IdpOrgSyncPageView",
13+
component: IdpOrgSyncPageView,
14+
};
15+
16+
export default meta;
17+
type Story = StoryObj<typeof IdpOrgSyncPageView>;
18+
19+
export const Empty: Story = {
20+
args: {
21+
organizationSyncSettings: {
22+
field: "",
23+
mapping: {},
24+
organization_assign_default: true,
25+
},
26+
organizations: [MockOrganization, MockOrganization2],
27+
error: undefined,
28+
},
29+
};
30+
31+
export const Default: Story = {
32+
args: {
33+
organizationSyncSettings: MockOrganizationSyncSettings2,
34+
organizations: [MockOrganization, MockOrganization2],
35+
error: undefined,
36+
},
37+
};
38+
39+
export const HasError: Story = {
40+
args: {
41+
...Default.args,
42+
error: "This is a test error",
43+
},
44+
};
45+
46+
export const MissingGroups: Story = {
47+
args: {
48+
...Default.args,
49+
organizationSyncSettings: MockOrganizationSyncSettings,
50+
},
51+
};
52+
53+
// export const RolesTab: Story = {
54+
// args: {
55+
// ...Default.args,
56+
// },
57+
// play: async ({ canvasElement }) => {
58+
// const user = userEvent.setup();
59+
// const canvas = within(canvasElement);
60+
// const rolesTab = await canvas.findByText("Role Sync Settings");
61+
// await user.click(rolesTab);
62+
// await expect(canvas.findByText("IdP Role")).resolves.toBeVisible();
63+
// },
64+
// };

site/src/testHelpers/entities.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2686,6 +2686,16 @@ export const MockOrganizationSyncSettings: TypesGen.OrganizationSyncSettings = {
26862686
organization_assign_default: true,
26872687
};
26882688

2689+
export const MockOrganizationSyncSettings2: TypesGen.OrganizationSyncSettings =
2690+
{
2691+
field: "organization-test",
2692+
mapping: {
2693+
"idp-org-1": ["my-organization-id", "my-organization-2-id"],
2694+
"idp-org-2": ["my-organization-id"],
2695+
},
2696+
organization_assign_default: true,
2697+
};
2698+
26892699
export const MockGroup: TypesGen.Group = {
26902700
id: "fbd2116a-8961-4954-87ae-e4575bd29ce0",
26912701
name: "Front-End",

0 commit comments

Comments
 (0)