diff --git a/src/core/domain/models/DvObjectOwnerNode.ts b/src/core/domain/models/DvObjectOwnerNode.ts index 89a893ce..ff661dd5 100644 --- a/src/core/domain/models/DvObjectOwnerNode.ts +++ b/src/core/domain/models/DvObjectOwnerNode.ts @@ -4,6 +4,7 @@ export interface DvObjectOwnerNode { identifier: string persistentIdentifier?: string version?: string + isReleased?: boolean isPartOf?: DvObjectOwnerNode } diff --git a/src/core/infra/repositories/transformers/OwnerNodePayload.ts b/src/core/infra/repositories/transformers/OwnerNodePayload.ts index 4828a3f1..0bac3de0 100644 --- a/src/core/infra/repositories/transformers/OwnerNodePayload.ts +++ b/src/core/infra/repositories/transformers/OwnerNodePayload.ts @@ -4,5 +4,6 @@ export interface OwnerNodePayload { identifier: string persistentIdentifier?: string version?: string + isReleased?: boolean isPartOf?: OwnerNodePayload } diff --git a/src/core/infra/repositories/transformers/dvObjectOwnerNodeTransformer.ts b/src/core/infra/repositories/transformers/dvObjectOwnerNodeTransformer.ts index 2bb9da10..1a56efe7 100644 --- a/src/core/infra/repositories/transformers/dvObjectOwnerNodeTransformer.ts +++ b/src/core/infra/repositories/transformers/dvObjectOwnerNodeTransformer.ts @@ -12,6 +12,7 @@ export const transformPayloadToOwnerNode = ( persistentIdentifier: ownerNodePayload.persistentIdentifier }), ...(ownerNodePayload.version && { version: ownerNodePayload.version }), + ...(ownerNodePayload.isReleased !== undefined && { isReleased: ownerNodePayload.isReleased }), ...(ownerNodePayload.isPartOf && { isPartOf: transformPayloadToOwnerNode(ownerNodePayload.isPartOf) }) diff --git a/test/environment/.env b/test/environment/.env index 68ddc5ed..80e9a14e 100644 --- a/test/environment/.env +++ b/test/environment/.env @@ -1,6 +1,6 @@ POSTGRES_VERSION=13 DATAVERSE_DB_USER=dataverse SOLR_VERSION=9.3.0 -DATAVERSE_IMAGE_REGISTRY=ghcr.io -DATAVERSE_IMAGE_TAG=10857-add-expiration-date-to-recreate-token-api +DATAVERSE_IMAGE_REGISTRY=docker.io +DATAVERSE_IMAGE_TAG=unstable DATAVERSE_BOOTSTRAP_TIMEOUT=5m diff --git a/test/integration/collections/CollectionsRepository.test.ts b/test/integration/collections/CollectionsRepository.test.ts index d6d569d3..be293662 100644 --- a/test/integration/collections/CollectionsRepository.test.ts +++ b/test/integration/collections/CollectionsRepository.test.ts @@ -148,6 +148,7 @@ describe('CollectionsRepository', () => { expect(createdCollection.isPartOf.type).toBe('DATAVERSE') expect(createdCollection.isPartOf.displayName).toBe('Root') expect(createdCollection.isPartOf.identifier).toBe('root') + expect(createdCollection.isPartOf.isReleased).toBe(true) expect(createdCollection.inputLevels?.length).toBe(1) const inputLevel = createdCollection.inputLevels?.[0] diff --git a/test/integration/datasets/DatasetsRepository.test.ts b/test/integration/datasets/DatasetsRepository.test.ts index 2fc0e1e7..7bfafcd1 100644 --- a/test/integration/datasets/DatasetsRepository.test.ts +++ b/test/integration/datasets/DatasetsRepository.test.ts @@ -246,6 +246,35 @@ describe('DatasetsRepository', () => { ).rejects.toThrow(expectedError) }) }) + + describe('returns correct isPartOf properties', () => { + test('should return isPartOf property correctly when dataset is part of an unpublished collection', async () => { + const isPartOfTestCollectionAlias = 'isPartOfTestCollection' + + const { alias: createdCollectionAlias } = await createCollectionViaApi( + isPartOfTestCollectionAlias + ) + + const { numericId: createdDatasetNumericId } = await createDataset.execute( + TestConstants.TEST_NEW_DATASET_DTO, + createdCollectionAlias + ) + + const actual = await sut.getDataset( + createdDatasetNumericId, + DatasetNotNumberedVersion.LATEST, + false + ) + + expect(actual.id).toBe(createdDatasetNumericId) + expect(actual.isPartOf.type).toBe('DATAVERSE') + expect(actual.isPartOf.identifier).toBe(isPartOfTestCollectionAlias) + expect(actual.isPartOf.isReleased).toBe(false) + + await deleteUnpublishedDatasetViaApi(createdDatasetNumericId) + await deleteCollectionViaApi(isPartOfTestCollectionAlias) + }) + }) }) describe('Private URLs', () => {