|
| 1 | +import { Meta, StoryObj } from "@storybook/react"; |
| 2 | +import { expect, within } from "@storybook/test"; |
| 3 | + |
| 4 | +import { auditLogItemFactory } from "../../fixtures/auditLog"; |
| 5 | +import { userFactory } from "../../fixtures/user"; |
| 6 | +import { DestructionListEditPage } from "../../pages"; |
| 7 | +import { DestructionListAuditLogDetails } from "./DestructionListAuditLogDetails"; |
| 8 | + |
| 9 | +const meta: Meta<typeof DestructionListEditPage> = { |
| 10 | + title: "Components/Audit Log/DestructionListAuditLogDetails", |
| 11 | + component: DestructionListAuditLogDetails, |
| 12 | +}; |
| 13 | + |
| 14 | +export default meta; |
| 15 | + |
| 16 | +// Story for DestructionListAuditLogDetails |
| 17 | +export const AuditLogDetails: StoryObj<typeof DestructionListAuditLogDetails> = |
| 18 | + { |
| 19 | + render: (args) => <DestructionListAuditLogDetails {...args} />, |
| 20 | + args: { |
| 21 | + readyForFirstReviewLogItem: auditLogItemFactory({ |
| 22 | + extraData: { |
| 23 | + minArchiefactiedatum: "2021-01-01T00:00:00Z", |
| 24 | + maxArchiefactiedatum: "2021-12-31T00:00:00Z", |
| 25 | + comment: "This is a comment", |
| 26 | + numberOfZaken: 10, |
| 27 | + }, |
| 28 | + user: userFactory({ |
| 29 | + username: "johndoe", |
| 30 | + firstName: "John", |
| 31 | + lastName: "Doe", |
| 32 | + }), |
| 33 | + }), |
| 34 | + }, |
| 35 | + play: async ({ canvasElement }) => { |
| 36 | + const canvas = within(canvasElement); |
| 37 | + |
| 38 | + const rows = canvas.getAllByRole("row"); |
| 39 | + expect(rows).toHaveLength(7); |
| 40 | + |
| 41 | + expect(canvas.getByText("John Doe (johndoe)")).toBeInTheDocument(); |
| 42 | + expect( |
| 43 | + canvas.getByText("van 01/01/2021 01:00 tot 31/12/2021 01:00"), |
| 44 | + ).toBeInTheDocument(); |
| 45 | + expect(canvas.getByText("This is a comment")).toBeInTheDocument(); |
| 46 | + expect(canvas.getByText("10")).toBeInTheDocument; |
| 47 | + }, |
| 48 | + }; |
0 commit comments