Skip to content

Commit

Permalink
Merge pull request #199 from IQSS/194-isReleased-to-DvObjectOwnerNode
Browse files Browse the repository at this point in the history
Add isReleased to collection DvObjectOwnerNode.
  • Loading branch information
ofahimIQSS authored Oct 10, 2024
2 parents b202fb0 + f80f74d commit 1913993
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/core/domain/models/DvObjectOwnerNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export interface DvObjectOwnerNode {
identifier: string
persistentIdentifier?: string
version?: string
isReleased?: boolean
isPartOf?: DvObjectOwnerNode
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ export interface OwnerNodePayload {
identifier: string
persistentIdentifier?: string
version?: string
isReleased?: boolean
isPartOf?: OwnerNodePayload
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down
4 changes: 2 additions & 2 deletions test/environment/.env
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions test/integration/collections/CollectionsRepository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
29 changes: 29 additions & 0 deletions test/integration/datasets/DatasetsRepository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 1913993

Please sign in to comment.