From 8033dccea2e98d4a8423432f25ad02a35d4efe8c Mon Sep 17 00:00:00 2001 From: Ellen Kraffmiller Date: Thu, 19 Oct 2023 07:59:30 -0400 Subject: [PATCH] fix: Dataset object in stories --- src/stories/dataset/Dataset.stories.tsx | 10 ++---- .../dataset-alerts/DatasetAlert.stories.tsx | 32 ++++++++++++++++--- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/stories/dataset/Dataset.stories.tsx b/src/stories/dataset/Dataset.stories.tsx index f553dfdb8..255e5a768 100644 --- a/src/stories/dataset/Dataset.stories.tsx +++ b/src/stories/dataset/Dataset.stories.tsx @@ -13,7 +13,6 @@ import { WithDataset } from './WithDataset' import { WithDatasetDraftAsOwner } from './WithDatasetDraftAsOwner' import { WithDatasetNotFound } from './WithDatasetNotFound' import { WithDatasetLoading } from './WithDatasetLoading' -import { DatasetMockDraftVersionRepository } from './DatasetMockDraftVersionRepository' import { WithLoggedInUser } from '../WithLoggedInUser' const meta: Meta = { @@ -36,16 +35,11 @@ export const Default: Story = { export const DraftWithAllDatasetPermissions: Story = { decorators: [WithLayout, WithDatasetDraftAsOwner, WithLoggedInUser, WithFilePermissionsGranted], - render: () => + render: () => } export const LoggedInAsOwner: Story = { decorators: [WithDataset, WithLayout, WithLoggedInUser, WithFilePermissionsGranted], - render: () => ( - - ) + render: () => } export const Loading: Story = { diff --git a/src/stories/dataset/dataset-alerts/DatasetAlert.stories.tsx b/src/stories/dataset/dataset-alerts/DatasetAlert.stories.tsx index 5733afcd1..098d0ad74 100644 --- a/src/stories/dataset/dataset-alerts/DatasetAlert.stories.tsx +++ b/src/stories/dataset/dataset-alerts/DatasetAlert.stories.tsx @@ -1,5 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react' -import { DatasetMockData } from '../DatasetMockData' + import { DatasetAlert, DatasetAlertMessageKey, @@ -9,6 +9,10 @@ import { import { DatasetAlerts } from '../../../sections/dataset/dataset-alerts/DatasetAlerts' import { WithI18next } from '../../WithI18next' +import { WithDatasetDraftAsOwner } from '../WithDatasetDraftAsOwner' +import { useDataset } from '../../../sections/dataset/DatasetContext' +import { DatasetMother } from '../../../../tests/component/dataset/domain/models/DatasetMother' + const meta: Meta = { title: 'Sections/Dataset Page/DatasetAlerts', component: DatasetAlerts, @@ -19,9 +23,16 @@ export default meta type Story = StoryObj export const DraftVersion: Story = { + decorators: [WithDatasetDraftAsOwner], render: () => { - const dataset = DatasetMockData({ - version: new DatasetVersion(1, DatasetPublishingStatus.DRAFT, 1, 0) + const dataset = DatasetMother.createRealistic({ + version: new DatasetVersion( + 1, + DatasetPublishingStatus.DRAFT, + true, + false, + DatasetPublishingStatus.DRAFT + ) }) return (
@@ -30,11 +41,22 @@ export const DraftVersion: Story = { ) } } + export const VersionNotFound: Story = { render: () => { - const dataset = DatasetMockData({ - version: new DatasetVersion(1, DatasetPublishingStatus.RELEASED, 1, 0, '3.0') + const dataset = DatasetMother.createRealistic({ + version: new DatasetVersion( + 1, + DatasetPublishingStatus.RELEASED, + true, + false, + DatasetPublishingStatus.RELEASED, + 1, + 0, + '3.0' + ) }) + return (