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

Add isReleased to collection DvObjectOwnerNode. #199

Merged
merged 3 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading