Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/223 integration citation for deaccessioned dataset #247

Merged
Merged
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"dependencies": {
"@faker-js/faker": "7.6.0",
"@iqss/dataverse-client-javascript": "2.0.0-pr99.c36f1db",
"@iqss/dataverse-client-javascript": "2.0.0-pr105.779a3f4",
MellyGray marked this conversation as resolved.
Show resolved Hide resolved
"@iqss/dataverse-design-system": "*",
"@istanbuljs/nyc-config-typescript": "1.0.2",
"@tanstack/react-table": "8.9.2",
Expand Down
5 changes: 5 additions & 0 deletions src/stories/dataset/Dataset.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { WithDatasetNotFound } from './WithDatasetNotFound'
import { WithDatasetLoading } from './WithDatasetLoading'
import { WithLoggedInUser } from '../WithLoggedInUser'
import { WithAlerts } from '../WithAlerts'
import { WithDeaccessionedDataset } from './WithDeaccessionedDataset'
import { WithNotImplementedModal } from '../WithNotImplementedModal'

const meta: Meta<typeof Dataset> = {
Expand Down Expand Up @@ -46,6 +47,10 @@ export const DraftWithAllDatasetPermissions: Story = {
],
render: () => <Dataset fileRepository={new FileMockRepository()} />
}
export const Deaccessioned: Story = {
decorators: [WithLayout, WithDeaccessionedDataset, WithLoggedInUser, WithFilePermissionsGranted],
render: () => <Dataset fileRepository={new FileMockRepository()} />
}
export const LoggedInAsOwner: Story = {
decorators: [
WithDataset,
Expand Down
44 changes: 44 additions & 0 deletions src/stories/dataset/WithDeaccessionedDataset.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { StoryFn } from '@storybook/react'
import { DatasetProvider } from '../../sections/dataset/DatasetProvider'
import { DatasetRepository } from '../../dataset/domain/repositories/DatasetRepository'
import {
Dataset,
DatasetPublishingStatus,
DatasetVersion
} from '../../dataset/domain/models/Dataset'
import { DatasetMother } from '../../../tests/component/dataset/domain/models/DatasetMother'

export const WithDeaccessionedDataset = (Story: StoryFn) => {
const datasetRepository = {} as DatasetRepository
datasetRepository.getByPersistentId = (
// eslint-disable-next-line unused-imports/no-unused-vars
persistentId: string,
// eslint-disable-next-line unused-imports/no-unused-vars
version?: string | undefined
): Promise<Dataset | undefined> => {
return new Promise((resolve) => {
setTimeout(() => {
resolve(
DatasetMother.createRealistic({
version: new DatasetVersion(
1,
DatasetPublishingStatus.DEACCESSIONED,
true,
false,
DatasetPublishingStatus.DEACCESSIONED,
1,
0
)
})
)
}, 1000)
})
}
return (
<DatasetProvider
repository={datasetRepository}
searchParams={{ persistentId: 'doi:10.5072/FK2/8YOKQI' }}>
<Story />
</DatasetProvider>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import {
DatasetPermissionsMother,
DatasetVersionMother
} from '../../../../tests/component/dataset/domain/models/DatasetMother'
import { WithLoggedInUser } from '../../WithLoggedInUser'

const meta: Meta<typeof DatasetActionButtons> = {
title: 'Sections/Dataset Page/DatasetActionButtons',
component: DatasetActionButtons,
decorators: [WithI18next, WithSettings],
decorators: [WithI18next, WithSettings, WithLoggedInUser],
parameters: {
// Sets the delay for all stories.
chromatic: { delay: 15000, pauseAnimationAtEnd: true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import {
DatasetVersionMother
} from '../../../../../tests/component/dataset/domain/models/DatasetMother'
import { PublishDatasetMenu } from '../../../../sections/dataset/dataset-action-buttons/publish-dataset-menu/PublishDatasetMenu'
import { WithLoggedInUser } from '../../../WithLoggedInUser'

const meta: Meta<typeof PublishDatasetMenu> = {
title: 'Sections/Dataset Page/DatasetActionButtons/PublishDatasetMenu',
component: PublishDatasetMenu,
decorators: [WithI18next, WithSettings],
decorators: [WithI18next, WithSettings, WithLoggedInUser],
parameters: {
// Sets the delay for all stories.
chromatic: { delay: 15000, pauseAnimationAtEnd: true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ describe('Dataset', () => {
})
})

it.skip('successfully loads a dataset deaccessioned', () => {
it('successfully loads a dataset deaccessioned', () => {
// TODO - Implement once the getDatasetCitation includes deaccessioned datasets
MellyGray marked this conversation as resolved.
Show resolved Hide resolved
cy.wrap(DatasetHelper.create())
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
Expand Down