Skip to content

Commit da60ecd

Browse files
committed
test: add integration test for checking isParOf.isReleased booleans
1 parent 374a00c commit da60ecd

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

test/environment/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ POSTGRES_VERSION=13
22
DATAVERSE_DB_USER=dataverse
33
SOLR_VERSION=9.3.0
44
DATAVERSE_IMAGE_REGISTRY=ghcr.io
5-
DATAVERSE_IMAGE_TAG=10857-add-expiration-date-to-recreate-token-api
5+
DATAVERSE_IMAGE_TAG=10849-add-isreleased-field-to-ispartof
66
DATAVERSE_BOOTSTRAP_TIMEOUT=5m

test/integration/collections/CollectionsRepository.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ describe('CollectionsRepository', () => {
148148
expect(createdCollection.isPartOf.type).toBe('DATAVERSE')
149149
expect(createdCollection.isPartOf.displayName).toBe('Root')
150150
expect(createdCollection.isPartOf.identifier).toBe('root')
151+
expect(createdCollection.isPartOf.isReleased).toBe(true)
151152

152153
expect(createdCollection.inputLevels?.length).toBe(1)
153154
const inputLevel = createdCollection.inputLevels?.[0]

test/integration/datasets/DatasetsRepository.test.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,35 @@ describe('DatasetsRepository', () => {
246246
).rejects.toThrow(expectedError)
247247
})
248248
})
249+
250+
describe('returns correct isPartOf properties', () => {
251+
test('should return isPartOf property correctly when dataset is part of an unpublished collection', async () => {
252+
const isPartOfTestCollectionAlias = 'isPartOfTestCollection'
253+
254+
const { alias: createdCollectionAlias } = await createCollectionViaApi(
255+
isPartOfTestCollectionAlias
256+
)
257+
258+
const { numericId: createdDatasetNumericId } = await createDataset.execute(
259+
TestConstants.TEST_NEW_DATASET_DTO,
260+
createdCollectionAlias
261+
)
262+
263+
const actual = await sut.getDataset(
264+
createdDatasetNumericId,
265+
DatasetNotNumberedVersion.LATEST,
266+
false
267+
)
268+
269+
expect(actual.id).toBe(createdDatasetNumericId)
270+
expect(actual.isPartOf.type).toBe('DATAVERSE')
271+
expect(actual.isPartOf.identifier).toBe(isPartOfTestCollectionAlias)
272+
expect(actual.isPartOf.isReleased).toBe(false)
273+
274+
await deleteUnpublishedDatasetViaApi(createdDatasetNumericId)
275+
await deleteCollectionViaApi(isPartOfTestCollectionAlias)
276+
})
277+
})
249278
})
250279

251280
describe('Private URLs', () => {

0 commit comments

Comments
 (0)