|
| 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 | +// }; |
0 commit comments