From 35ac5c402a9b24d9908e159624ee45ec565ee5e9 Mon Sep 17 00:00:00 2001 From: MellyGray Date: Wed, 4 Oct 2023 12:25:10 +0200 Subject: [PATCH] feat(DeaccessionedFiles): implement integration test --- src/files/infrastructure/mappers/JSFileMapper.ts | 8 ++++---- .../integration/files/FileJSDataverseRepository.spec.ts | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/files/infrastructure/mappers/JSFileMapper.ts b/src/files/infrastructure/mappers/JSFileMapper.ts index 201606a27..316c5019c 100644 --- a/src/files/infrastructure/mappers/JSFileMapper.ts +++ b/src/files/infrastructure/mappers/JSFileMapper.ts @@ -82,14 +82,14 @@ export class JSFileMapper { ): FileVersion { const fileVersion = { number: jsVersion, publishingStatus: FilePublishingStatus.DRAFT } - if (datasetVersion.publishingStatus === DatasetPublishingStatus.DEACCESSIONED) { - fileVersion.publishingStatus = FilePublishingStatus.DEACCESSIONED - } - if (jsPublicationDate) { fileVersion.publishingStatus = FilePublishingStatus.RELEASED } + if (datasetVersion.publishingStatus === DatasetPublishingStatus.DEACCESSIONED) { + fileVersion.publishingStatus = FilePublishingStatus.DEACCESSIONED + } + return fileVersion } diff --git a/tests/e2e-integration/integration/files/FileJSDataverseRepository.spec.ts b/tests/e2e-integration/integration/files/FileJSDataverseRepository.spec.ts index 16f569f9b..da0ec217c 100644 --- a/tests/e2e-integration/integration/files/FileJSDataverseRepository.spec.ts +++ b/tests/e2e-integration/integration/files/FileJSDataverseRepository.spec.ts @@ -156,7 +156,7 @@ describe('File JSDataverse Repository', () => { }) }) - it.skip('gets all the files by dataset persistentId after dataset deaccession', async () => { + it.only('gets all the files by dataset persistentId after dataset deaccession', async () => { const dataset = await DatasetHelper.createWithFiles(FileHelper.createMany(3)).then( (datasetResponse) => datasetRepository.getByPersistentId(datasetResponse.persistentId) ) @@ -170,7 +170,6 @@ describe('File JSDataverse Repository', () => { await TestsUtils.wait(1500) // Wait for the dataset to be deaccessioned await TestsUtils.wait(1500) // Wait for the dataset to be deaccessioned - // TODO - It always returns 404 when the dataset is deaccessioned, update the test when the issue is fixed await fileRepository .getAllByDatasetPersistentId( dataset.persistentId,