Skip to content

Commit e6fb912

Browse files
Julian Roelandsvenvandescheur
Julian Roeland
authored andcommitted
🎨 - added story for auditlogdetails
1 parent 5da6712 commit e6fb912

File tree

3 files changed

+56
-1
lines changed

3 files changed

+56
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
};

frontend/src/components/DestructionListAuditLog/DestructionListAuditLogHistory.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { formatDate } from "../../lib/format/date";
77
import { DestructionListAuditLogHistory } from "./DestructionListAuditLogHistory";
88

99
const meta: Meta<typeof DestructionListAuditLogHistory> = {
10-
title: "Components/DestructionListAuditLogHistory",
10+
title: "Components/Audit Log/DestructionListAuditLogHistory",
1111
component: DestructionListAuditLogHistory,
1212
args: {
1313
logItems: [

frontend/src/fixtures/auditLog.ts

+7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ export const FIXTURE_AUDIT_LOG_ITEM: AuditLogItem = {
2020
pk: destructionList.pk,
2121
name: destructionList.name,
2222
author: recordManager,
23+
minArchiefactiedatum: "2023-09-15T21:36:00+02:00",
24+
maxArchiefactiedatum: "2023-09-15T21:36:00+02:00",
25+
zaaktypen: [],
26+
resultaten: [],
27+
archiefnominaties: [],
28+
comment: "This is a comment",
29+
numberOfZaken: 123,
2330
assignees: [beoordelaarFactory(), procesEigenaarFactory()],
2431
},
2532
};

0 commit comments

Comments
 (0)