diff --git a/frontend/src/pages/destructionlist/review/DestructionListReview.stories.tsx b/frontend/src/pages/destructionlist/review/DestructionListReview.stories.tsx index 2c6923a9..1eda330e 100644 --- a/frontend/src/pages/destructionlist/review/DestructionListReview.stories.tsx +++ b/frontend/src/pages/destructionlist/review/DestructionListReview.stories.tsx @@ -12,7 +12,7 @@ import { destructionListAssigneesFactory, destructionListFactory, } from "../../../fixtures/destructionList"; -import { paginatedDestructionListItemsFailedFactory } from "../../../fixtures/destructionListItem"; +import { paginatedDestructionListItemsFactory } from "../../../fixtures/destructionListItem"; import { reviewFactory } from "../../../fixtures/review"; import { beoordelaarFactory, @@ -20,15 +20,7 @@ import { userFactory, usersFactory, } from "../../../fixtures/user"; -import { - getFilteredZaakSelection, - getZaakSelectionItems, -} from "../../../lib/zaakSelection"; -import { Zaak } from "../../../types"; -import { - DestructionListReviewPage, - getDestructionListReviewKey, -} from "./DestructionListReview"; +import { DestructionListReviewPage } from "./DestructionListReview"; import { destructionListReviewAction } from "./DestructionListReview.action"; import { DestructionListReviewContext } from "./DestructionListReview.loader"; @@ -175,47 +167,14 @@ const FIXTURE: DestructionListReviewContext = { logItems: [], review: reviewFactory(), reviewers: usersFactory(), - paginatedZaken: paginatedDestructionListItemsFailedFactory(), + paginatedZaken: paginatedDestructionListItemsFactory(), }; export const ReviewerCanApproveZaak: Story = { parameters: { reactRouterDecorator: { route: { - loader: async () => { - const storageKey = getDestructionListReviewKey( - FIXTURE.uuid, - FIXTURE.destructionList.status, - ); - const zakenResults = FIXTURE.paginatedZaken.results - .map((zaak) => zaak.zaak) - .filter((zaak) => zaak !== null) as Zaak[]; - const zakenOnPage = zakenResults.map((z) => z.url as string); - - const approvedZaakUrlsOnPagePromise = await Promise.all( - zakenOnPage.map(async (url) => { - const selection = await getZaakSelectionItems<{ - approved: boolean; - }>(storageKey, [url]); - const item = selection[url]; - return { url, approved: item?.detail?.approved }; - }), - ); - - const approvedZaakUrlsOnPage = approvedZaakUrlsOnPagePromise - .filter((result) => result.approved) - .map((result) => result.url); - - const excludedZaakSelection = await getFilteredZaakSelection<{ - approved: false; - }>(storageKey, { approved: false }); - - return { - ...FIXTURE, - approvedZaakUrlsOnPage, - excludedZaakSelection, - }; - }, + loader: async () => FIXTURE, action: destructionListReviewAction, }, }, @@ -227,8 +186,10 @@ export const ReviewerCanApproveZaak: Story = { }); const approve = approves[0]; await userEvent.click(approve); - const checkbox = await canvas.findByRole("checkbox", { checked: true }); - await expect(checkbox).toBeInTheDocument(); + // Find all checkboxes + const checkboxes = await canvas.findAllByRole("checkbox"); + const checkbox = checkboxes[0]; + await expect(checkbox).toBeChecked(); }, };