diff --git a/src/stories/collection/CollectionInfo.stories.tsx b/src/stories/collection/CollectionInfo.stories.tsx
index f7d932c9e..67e7b2d74 100644
--- a/src/stories/collection/CollectionInfo.stories.tsx
+++ b/src/stories/collection/CollectionInfo.stories.tsx
@@ -24,6 +24,9 @@ export const WithAffiliation: Story = {
render: () =>
}
+export const Unpublished: Story = {
+ render: () =>
+}
export const WithDescription: Story = {
render: () =>
}
diff --git a/tests/component/collection/domain/models/CollectionMother.ts b/tests/component/collection/domain/models/CollectionMother.ts
index 157b872d7..b5441d735 100644
--- a/tests/component/collection/domain/models/CollectionMother.ts
+++ b/tests/component/collection/domain/models/CollectionMother.ts
@@ -8,6 +8,7 @@ export class CollectionMother {
return {
id: faker.datatype.uuid(),
name: faker.lorem.words(3),
+ isReleased: faker.datatype.boolean(),
description: faker.datatype.boolean()
? `${faker.lorem.paragraph()} **${faker.lorem.sentence()}** ${faker.lorem.paragraph()}`
: undefined,
@@ -20,6 +21,7 @@ export class CollectionMother {
static createRealistic(): Collection {
return CollectionMother.create({
id: 'science',
+ isReleased: true,
name: 'Collection Name',
description: 'We do all the science.',
affiliation: 'Scientific Research University'
@@ -30,6 +32,7 @@ export class CollectionMother {
return CollectionMother.create({
id: faker.datatype.uuid(),
name: FakerHelper.collectionName(),
+ isReleased: faker.datatype.boolean(),
affiliation: undefined,
description: undefined,
...props
@@ -39,12 +42,18 @@ export class CollectionMother {
static createComplete(): Collection {
return CollectionMother.create({
id: faker.datatype.uuid(),
+ isReleased: faker.datatype.boolean(),
name: FakerHelper.collectionName(),
description: FakerHelper.paragraph(),
affiliation: FakerHelper.affiliation()
})
}
-
+ static createUnpublished(): Collection {
+ return CollectionMother.createWithOnlyRequiredFields({
+ isReleased: false,
+ affiliation: FakerHelper.affiliation()
+ })
+ }
static createWithDescription(): Collection {
return CollectionMother.createWithOnlyRequiredFields({
description: FakerHelper.paragraph()
diff --git a/tests/component/sections/collection/CollectionInfo.spec.tsx b/tests/component/sections/collection/CollectionInfo.spec.tsx
index b3bd13073..08fb12bd3 100644
--- a/tests/component/sections/collection/CollectionInfo.spec.tsx
+++ b/tests/component/sections/collection/CollectionInfo.spec.tsx
@@ -6,6 +6,7 @@ describe('CollectionInfo', () => {
const collection = CollectionMother.create({
name: 'Collection Name',
affiliation: 'Affiliation',
+ isReleased: true,
description: 'Here is a description with [a link](https://dataverse.org)'
})
cy.customMount()
@@ -14,6 +15,7 @@ describe('CollectionInfo', () => {
cy.findByText('(Affiliation)').should('exist')
cy.findByText(/Here is a description with/).should('exist')
cy.findByRole('link', { name: 'a link' }).should('exist')
+ cy.findByText('Unpublished').should('not.exist')
})
it('does not render affiliation when it is not present', () => {
@@ -33,4 +35,10 @@ describe('CollectionInfo', () => {
cy.findByText('Description').should('not.exist')
})
+ it('renders unpublished label when isReleased is false', () => {
+ const collection = CollectionMother.createUnpublished()
+ cy.customMount()
+
+ cy.findByText('Unpublished').should('exist')
+ })
})