From 53eb9e15a74e1ea91bdfe763ade71beafc040086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Saracca?= Date: Thu, 27 Mar 2025 17:06:11 -0300 Subject: [PATCH 1/7] feat: add includeDeaccessioned param --- docs/useCases.md | 2 + .../domain/models/DatasetVersionDiff.ts | 3 ++ .../repositories/IDatasetsRepository.ts | 3 +- .../domain/useCases/GetDatasetVersionDiff.ts | 7 ++- .../infra/repositories/DatasetsRepository.ts | 8 +++- .../datasets/DatasetsRepository.test.ts | 43 +++++++++++++++++-- 6 files changed, 57 insertions(+), 9 deletions(-) diff --git a/docs/useCases.md b/docs/useCases.md index f44487a8..6d553055 100644 --- a/docs/useCases.md +++ b/docs/useCases.md @@ -593,6 +593,8 @@ The `datasetId` parameter can be a string, for persistent identifiers, or a numb The `oldVersion` and `newVersion` parameters specify the versions of the dataset to compare. +There is an optional third parameter called `includeDeaccessioned`, by default, deaccessioned dataset versions are not included in the search when applying the `:latest` or `:latest-published` identifiers. If not set, the default value is `false`. + #### List All Datasets Returns an instance of [DatasetPreviewSubset](../src/datasets/domain/models/DatasetPreviewSubset.ts) that contains reduced information for each dataset that the calling user can access in the installation. diff --git a/src/datasets/domain/models/DatasetVersionDiff.ts b/src/datasets/domain/models/DatasetVersionDiff.ts index e0f94fcf..2a8b32ff 100644 --- a/src/datasets/domain/models/DatasetVersionDiff.ts +++ b/src/datasets/domain/models/DatasetVersionDiff.ts @@ -1,3 +1,5 @@ +import { DatasetVersionState } from './Dataset' + export interface DatasetVersionDiff { oldVersion: VersionSummary newVersion: VersionSummary @@ -24,6 +26,7 @@ export interface FileSummary { export interface VersionSummary { versionNumber: string lastUpdatedDate: string + versionState: DatasetVersionState } export interface MetadataBlockDiff { blockName: string diff --git a/src/datasets/domain/repositories/IDatasetsRepository.ts b/src/datasets/domain/repositories/IDatasetsRepository.ts index ec830594..4b00ee4b 100644 --- a/src/datasets/domain/repositories/IDatasetsRepository.ts +++ b/src/datasets/domain/repositories/IDatasetsRepository.ts @@ -35,7 +35,8 @@ export interface IDatasetsRepository { getDatasetVersionDiff( datasetId: number | string, newVersionId: string, - oldVersionId: string + oldVersionId: string, + includeDeaccessioned: boolean ): Promise createDataset( newDataset: DatasetDTO, diff --git a/src/datasets/domain/useCases/GetDatasetVersionDiff.ts b/src/datasets/domain/useCases/GetDatasetVersionDiff.ts index d1499d7a..c12eacfc 100644 --- a/src/datasets/domain/useCases/GetDatasetVersionDiff.ts +++ b/src/datasets/domain/useCases/GetDatasetVersionDiff.ts @@ -14,16 +14,19 @@ export class GetDatasetVersionDiff implements UseCase { * @param {number | string} [datasetId] - The dataset identifier, which can be a string (for persistent identifiers), or a number (for numeric identifiers). * @param {string } [oldVersionId] - The dataset version identifier, which can be a version-specific numeric string (for example, 1.0) or a DatasetNotNumberedVersion enum value. * @param {string } [newVersionId] - The dataset version identifier, which can be a version-specific numeric string (for example, 1.0) or a DatasetNotNumberedVersion enum value. + * @param {boolean} [includeDeaccessioned=false] - Indicates if you want to include deaccessioned dataset versions. The default value is false */ async execute( datasetId: number | string, oldVersionId: string, - newVersionId: string + newVersionId: string, + includeDeaccessioned = false ): Promise { return await this.datasetsRepository.getDatasetVersionDiff( datasetId, oldVersionId, - newVersionId + newVersionId, + includeDeaccessioned ) } } diff --git a/src/datasets/infra/repositories/DatasetsRepository.ts b/src/datasets/infra/repositories/DatasetsRepository.ts index a88851c9..4c069134 100644 --- a/src/datasets/infra/repositories/DatasetsRepository.ts +++ b/src/datasets/infra/repositories/DatasetsRepository.ts @@ -149,7 +149,8 @@ export class DatasetsRepository extends ApiRepository implements IDatasetsReposi public async getDatasetVersionDiff( datasetId: string | number, oldVersionId: string, - newVersionId: string + newVersionId: string, + includeDeaccessioned: boolean ): Promise { return this.doGet( this.buildApiEndpoint( @@ -157,7 +158,10 @@ export class DatasetsRepository extends ApiRepository implements IDatasetsReposi `versions/${oldVersionId}/compare/${newVersionId}`, datasetId ), - true + true, + { + includeDeaccessioned + } ) .then((response) => transformDatasetVersionDiffResponseToDatasetVersionDiff(response)) .catch((error) => { diff --git a/test/integration/datasets/DatasetsRepository.test.ts b/test/integration/datasets/DatasetsRepository.test.ts index 5716de66..bb7d015f 100644 --- a/test/integration/datasets/DatasetsRepository.test.ts +++ b/test/integration/datasets/DatasetsRepository.test.ts @@ -491,6 +491,7 @@ describe('DatasetsRepository', () => { expect(typeof actualDatasetCitation).toBe('string') }) }) + describe('getDatasetVersionDiff', () => { let testDatasetIds: CreatedDatasetIdentifiers @@ -514,7 +515,8 @@ describe('DatasetsRepository', () => { const actual = await sut.getDatasetVersionDiff( testDatasetIds.numericId, '1.0', - DatasetNotNumberedVersion.DRAFT + DatasetNotNumberedVersion.DRAFT, + false ) expect(actual.metadataChanges?.[0]).not.toBeUndefined() expect(actual.metadataChanges?.[0].blockName).toEqual('Citation Metadata') @@ -549,12 +551,13 @@ describe('DatasetsRepository', () => { const actual = await sut.getDatasetVersionDiff( testDatasetIds.numericId, '1.0', - DatasetNotNumberedVersion.DRAFT + DatasetNotNumberedVersion.DRAFT, + false ) expect(actual.filesAdded).toEqual(expectedFilesAdded) }) - test('should return diff between :latestPublished and :draft', async () => { + test('should return diff between :latestPublished and :draft', async () => { const fileMetadata = { description: 'test description', directoryLabel: 'directoryLabel', @@ -583,11 +586,43 @@ describe('DatasetsRepository', () => { const actual = await sut.getDatasetVersionDiff( testDatasetIds.numericId, DatasetNotNumberedVersion.LATEST_PUBLISHED, - DatasetNotNumberedVersion.DRAFT + DatasetNotNumberedVersion.DRAFT, + false ) expect(actual.filesAdded).toEqual(expectedFilesAdded) }) + test('should return diff between :latestPublished deaccessioned and :draft when includeDeaccessioned param is true', async () => { + await deaccessionDatasetViaApi(testDatasetIds.numericId, '1.0') + + // Update dataset + const metadataBlocksRepository = new MetadataBlocksRepository() + const citationMetadataBlock = await metadataBlocksRepository.getMetadataBlockByName( + 'citation' + ) + + await sut.updateDataset(testDatasetIds.numericId, TEST_DIFF_DATASET_DTO, [ + citationMetadataBlock + ]) + + const actual = await sut.getDatasetVersionDiff( + testDatasetIds.numericId, + DatasetNotNumberedVersion.LATEST_PUBLISHED, + DatasetNotNumberedVersion.DRAFT, + true + ) + + expect(actual).not.toBeUndefined() + expect(actual.oldVersion.versionState).toBe('DEACCESSIONED') + expect(actual.oldVersion.versionNumber).toBe('1.0') + + expect(actual.newVersion.versionState).toBe('DRAFT') + expect(actual.newVersion.versionNumber).toBe('DRAFT') + + expect(actual.metadataChanges?.[0]).not.toBeUndefined() + expect(actual.metadataChanges?.[0].blockName).toEqual('Citation Metadata') + }) + afterEach(async () => { await deletePublishedDatasetViaApi(testDatasetIds.persistentId) }) From 778a932b0560d65af2f8912d369e96ba2a19a9cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Saracca?= Date: Thu, 27 Mar 2025 17:24:15 -0300 Subject: [PATCH 2/7] fix: ts error --- test/testHelpers/datasets/datasetVersionDiffHelper.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/testHelpers/datasets/datasetVersionDiffHelper.ts b/test/testHelpers/datasets/datasetVersionDiffHelper.ts index 34119142..fe99338f 100644 --- a/test/testHelpers/datasets/datasetVersionDiffHelper.ts +++ b/test/testHelpers/datasets/datasetVersionDiffHelper.ts @@ -1,3 +1,4 @@ +import { DatasetVersionState } from '../../../src' import { DatasetVersionDiff, VersionSummary, @@ -11,7 +12,8 @@ import { export const createDatasetVersionDiff = (): DatasetVersionDiff => { const versionSummary: VersionSummary = { versionNumber: '1.0', - lastUpdatedDate: '2023-05-15T08:21:03Z' + lastUpdatedDate: '2023-05-15T08:21:03Z', + versionState: DatasetVersionState.RELEASED } const metadataBlockDiff: MetadataBlockDiff = { From 09d1482e56652e9933efcbb8cf24e8685dd00e90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Saracca?= Date: Fri, 28 Mar 2025 08:49:56 -0300 Subject: [PATCH 3/7] fix: merge conflicts wrongly solved --- .../datasets/DatasetsRepository.test.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/test/integration/datasets/DatasetsRepository.test.ts b/test/integration/datasets/DatasetsRepository.test.ts index bb7d015f..3eee8c31 100644 --- a/test/integration/datasets/DatasetsRepository.test.ts +++ b/test/integration/datasets/DatasetsRepository.test.ts @@ -1280,6 +1280,16 @@ describe('DatasetsRepository', () => { await deletePublishedDatasetViaApi(testDatasetIds.persistentId) }) + + test('should return error when dataset does not exist', async () => { + const expectedError = new ReadError( + `[404] Dataset with ID ${nonExistentTestDatasetId} not found.` + ) + + await expect(sut.getDatasetVersionsSummaries(nonExistentTestDatasetId)).rejects.toThrow( + expectedError + ) + }) }) describe('getDatasetDownloadCount', () => { @@ -1316,14 +1326,6 @@ describe('DatasetsRepository', () => { await expect(sut.getDatasetDownloadCount(nonExistentTestDatasetId)).rejects.toBeInstanceOf( ReadError ) - - const expectedError = new ReadError( - `[404] Dataset with ID ${nonExistentTestDatasetId} not found.` - ) - - await expect(sut.getDatasetVersionsSummaries(nonExistentTestDatasetId)).rejects.toThrow( - expectedError - ) }) }) }) From bd9a1d5ba5671c9e8ab8b47deed7a1796d288893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Saracca?= Date: Fri, 28 Mar 2025 09:15:44 -0300 Subject: [PATCH 4/7] add step to check remaining data after tests , testing purposes only --- .github/workflows/deploy_pr.yml | 14 ++++++++ jest.config.check-remaining-data.ts | 10 ++++++ jest.config.functional.ts | 6 +++- jest.config.integration.ts | 6 +++- jest.config.unit.ts | 6 +++- package.json | 1 + .../check-remaining-data.spec.ts | 33 +++++++++++++++++++ tsconfig.tests.json | 3 +- 8 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 jest.config.check-remaining-data.ts create mode 100644 test/check-remaining-data/check-remaining-data.spec.ts diff --git a/.github/workflows/deploy_pr.yml b/.github/workflows/deploy_pr.yml index f8cba6dd..aae22d4e 100644 --- a/.github/workflows/deploy_pr.yml +++ b/.github/workflows/deploy_pr.yml @@ -45,6 +45,20 @@ jobs: - name: Run functional tests run: npm run test:functional + check-remaining-data-after-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 19 + + - name: Install npm dependencies + run: npm ci + + - name: Check remaining data after tests + run: npm run test:check-remaining-data + publish-gpr: needs: [test-unit, test-integration, test-functional] runs-on: ubuntu-latest diff --git a/jest.config.check-remaining-data.ts b/jest.config.check-remaining-data.ts new file mode 100644 index 00000000..f9138a56 --- /dev/null +++ b/jest.config.check-remaining-data.ts @@ -0,0 +1,10 @@ +import config from './jest.config' + +config.modulePathIgnorePatterns = [ + '/test/unit', + '/test/functional', + '/test/integration' +] +console.log('RUNNING TESTS TO GET FILE COUNTS') + +export default config diff --git a/jest.config.functional.ts b/jest.config.functional.ts index 01a71ab8..bf1f96b6 100644 --- a/jest.config.functional.ts +++ b/jest.config.functional.ts @@ -1,6 +1,10 @@ import config from './jest.config' -config.modulePathIgnorePatterns = ['/test/unit', '/test/integration'] +config.modulePathIgnorePatterns = [ + '/test/unit', + '/test/integration', + '/test/check-remaining-data' +] console.log('RUNNING FUNCTIONAL TESTS') export default config diff --git a/jest.config.integration.ts b/jest.config.integration.ts index 63512eca..cf649ce3 100644 --- a/jest.config.integration.ts +++ b/jest.config.integration.ts @@ -1,6 +1,10 @@ import config from './jest.config' -config.modulePathIgnorePatterns = ['/test/unit', '/test/functional'] +config.modulePathIgnorePatterns = [ + '/test/unit', + '/test/functional', + '/test/check-remaining-data' +] console.log('RUNNING INTEGRATION TESTS') export default config diff --git a/jest.config.unit.ts b/jest.config.unit.ts index b4f34350..62f0f267 100644 --- a/jest.config.unit.ts +++ b/jest.config.unit.ts @@ -1,6 +1,10 @@ import config from './jest.config' -config.modulePathIgnorePatterns = ['/test/integration', '/test/functional'] +config.modulePathIgnorePatterns = [ + '/test/integration', + '/test/functional', + '/test/check-remaining-data' +] delete config.globalSetup delete config.testTimeout console.log('RUNNING UNIT TESTS') diff --git a/package.json b/package.json index 15eee168..e94f47a7 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "test:unit": "jest -c jest.config.unit.ts", "test:integration": "jest -c jest.config.integration.ts", "test:functional": "jest -c jest.config.functional.ts", + "test:check-remaining-data": "jest -c jest.config.check-remaining-data.ts", "test:coverage": "jest --coverage -c jest.config.ts", "test:coverage:check": "jest --coverage --ci --config jest.config.ts", "lint": "npm run lint:eslint && npm run lint:prettier", diff --git a/test/check-remaining-data/check-remaining-data.spec.ts b/test/check-remaining-data/check-remaining-data.spec.ts new file mode 100644 index 00000000..fc2d7efb --- /dev/null +++ b/test/check-remaining-data/check-remaining-data.spec.ts @@ -0,0 +1,33 @@ +import { ApiConfig } from '../../src' +import { CollectionsRepository } from '../../src/collections/infra/repositories/CollectionsRepository' +import { DataverseApiAuthMechanism } from '../../src/core/infra/repositories/ApiConfig' +import { ROOT_COLLECTION_ALIAS } from '../testHelpers/collections/collectionHelper' +import { TestConstants } from '../testHelpers/TestConstants' + +describe('Checks remaining data', () => { + const sut: CollectionsRepository = new CollectionsRepository() + + beforeAll(async () => { + ApiConfig.init( + TestConstants.TEST_API_URL, + DataverseApiAuthMechanism.API_KEY, + process.env.TEST_API_KEY + ) + }) + + it('root collection info', async () => { + const collection = await sut.getCollection(ROOT_COLLECTION_ALIAS) + + console.log(JSON.stringify(collection, null, 2)) + + expect(1).toBe(1) + }) + + it('root collection items', async () => { + const items = await sut.getCollectionItems(ROOT_COLLECTION_ALIAS) + + console.log(JSON.stringify(items, null, 2)) + + expect(1).toBe(1) + }) +}) diff --git a/tsconfig.tests.json b/tsconfig.tests.json index fd0ea25b..0afd42d1 100644 --- a/tsconfig.tests.json +++ b/tsconfig.tests.json @@ -9,7 +9,8 @@ "jest.config.integration.ts", "jest.config.ts", "jest.config.unit.ts", - "jest.config.functional.ts" + "jest.config.functional.ts", + "jest.config.check-remaining-data.ts" ], "exclude": ["node_modules", "dist"] } From 54fb9678a0ccb063e4241d165e9e975c3985e553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Saracca?= Date: Fri, 28 Mar 2025 09:20:59 -0300 Subject: [PATCH 5/7] chore: rollback test changes --- .github/workflows/deploy_pr.yml | 14 -------- jest.config.check-remaining-data.ts | 10 ------ jest.config.functional.ts | 6 +--- jest.config.integration.ts | 6 +--- jest.config.unit.ts | 6 +--- package.json | 1 - .../check-remaining-data.spec.ts | 33 ------------------- tsconfig.tests.json | 3 +- 8 files changed, 4 insertions(+), 75 deletions(-) delete mode 100644 jest.config.check-remaining-data.ts delete mode 100644 test/check-remaining-data/check-remaining-data.spec.ts diff --git a/.github/workflows/deploy_pr.yml b/.github/workflows/deploy_pr.yml index aae22d4e..f8cba6dd 100644 --- a/.github/workflows/deploy_pr.yml +++ b/.github/workflows/deploy_pr.yml @@ -45,20 +45,6 @@ jobs: - name: Run functional tests run: npm run test:functional - check-remaining-data-after-tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 19 - - - name: Install npm dependencies - run: npm ci - - - name: Check remaining data after tests - run: npm run test:check-remaining-data - publish-gpr: needs: [test-unit, test-integration, test-functional] runs-on: ubuntu-latest diff --git a/jest.config.check-remaining-data.ts b/jest.config.check-remaining-data.ts deleted file mode 100644 index f9138a56..00000000 --- a/jest.config.check-remaining-data.ts +++ /dev/null @@ -1,10 +0,0 @@ -import config from './jest.config' - -config.modulePathIgnorePatterns = [ - '/test/unit', - '/test/functional', - '/test/integration' -] -console.log('RUNNING TESTS TO GET FILE COUNTS') - -export default config diff --git a/jest.config.functional.ts b/jest.config.functional.ts index bf1f96b6..01a71ab8 100644 --- a/jest.config.functional.ts +++ b/jest.config.functional.ts @@ -1,10 +1,6 @@ import config from './jest.config' -config.modulePathIgnorePatterns = [ - '/test/unit', - '/test/integration', - '/test/check-remaining-data' -] +config.modulePathIgnorePatterns = ['/test/unit', '/test/integration'] console.log('RUNNING FUNCTIONAL TESTS') export default config diff --git a/jest.config.integration.ts b/jest.config.integration.ts index cf649ce3..63512eca 100644 --- a/jest.config.integration.ts +++ b/jest.config.integration.ts @@ -1,10 +1,6 @@ import config from './jest.config' -config.modulePathIgnorePatterns = [ - '/test/unit', - '/test/functional', - '/test/check-remaining-data' -] +config.modulePathIgnorePatterns = ['/test/unit', '/test/functional'] console.log('RUNNING INTEGRATION TESTS') export default config diff --git a/jest.config.unit.ts b/jest.config.unit.ts index 62f0f267..b4f34350 100644 --- a/jest.config.unit.ts +++ b/jest.config.unit.ts @@ -1,10 +1,6 @@ import config from './jest.config' -config.modulePathIgnorePatterns = [ - '/test/integration', - '/test/functional', - '/test/check-remaining-data' -] +config.modulePathIgnorePatterns = ['/test/integration', '/test/functional'] delete config.globalSetup delete config.testTimeout console.log('RUNNING UNIT TESTS') diff --git a/package.json b/package.json index e94f47a7..15eee168 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,6 @@ "test:unit": "jest -c jest.config.unit.ts", "test:integration": "jest -c jest.config.integration.ts", "test:functional": "jest -c jest.config.functional.ts", - "test:check-remaining-data": "jest -c jest.config.check-remaining-data.ts", "test:coverage": "jest --coverage -c jest.config.ts", "test:coverage:check": "jest --coverage --ci --config jest.config.ts", "lint": "npm run lint:eslint && npm run lint:prettier", diff --git a/test/check-remaining-data/check-remaining-data.spec.ts b/test/check-remaining-data/check-remaining-data.spec.ts deleted file mode 100644 index fc2d7efb..00000000 --- a/test/check-remaining-data/check-remaining-data.spec.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { ApiConfig } from '../../src' -import { CollectionsRepository } from '../../src/collections/infra/repositories/CollectionsRepository' -import { DataverseApiAuthMechanism } from '../../src/core/infra/repositories/ApiConfig' -import { ROOT_COLLECTION_ALIAS } from '../testHelpers/collections/collectionHelper' -import { TestConstants } from '../testHelpers/TestConstants' - -describe('Checks remaining data', () => { - const sut: CollectionsRepository = new CollectionsRepository() - - beforeAll(async () => { - ApiConfig.init( - TestConstants.TEST_API_URL, - DataverseApiAuthMechanism.API_KEY, - process.env.TEST_API_KEY - ) - }) - - it('root collection info', async () => { - const collection = await sut.getCollection(ROOT_COLLECTION_ALIAS) - - console.log(JSON.stringify(collection, null, 2)) - - expect(1).toBe(1) - }) - - it('root collection items', async () => { - const items = await sut.getCollectionItems(ROOT_COLLECTION_ALIAS) - - console.log(JSON.stringify(items, null, 2)) - - expect(1).toBe(1) - }) -}) diff --git a/tsconfig.tests.json b/tsconfig.tests.json index 0afd42d1..fd0ea25b 100644 --- a/tsconfig.tests.json +++ b/tsconfig.tests.json @@ -9,8 +9,7 @@ "jest.config.integration.ts", "jest.config.ts", "jest.config.unit.ts", - "jest.config.functional.ts", - "jest.config.check-remaining-data.ts" + "jest.config.functional.ts" ], "exclude": ["node_modules", "dist"] } From bb6e74095a3ead39975fe3069eb2bf9fcc3f7aa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Saracca?= Date: Fri, 28 Mar 2025 09:43:58 -0300 Subject: [PATCH 6/7] test: delete datasets and collection used in get download count test --- .../datasets/DatasetsRepository.test.ts | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/test/integration/datasets/DatasetsRepository.test.ts b/test/integration/datasets/DatasetsRepository.test.ts index 3eee8c31..6013e182 100644 --- a/test/integration/datasets/DatasetsRepository.test.ts +++ b/test/integration/datasets/DatasetsRepository.test.ts @@ -1293,30 +1293,39 @@ describe('DatasetsRepository', () => { }) describe('getDatasetDownloadCount', () => { - test('should return download count for a dataset', async () => { - const testDatasetIds = await createDataset.execute(TestConstants.TEST_NEW_DATASET_DTO) + const testGetDatasetDownloadCountCollectionAlias = 'testGetDatasetDownloadCountCollection' + let testDatasetIds: CreatedDatasetIdentifiers + + beforeAll(async () => { + await createCollectionViaApi(testGetDatasetDownloadCountCollectionAlias) + await publishCollectionViaApi(testGetDatasetDownloadCountCollectionAlias) + testDatasetIds = await createDataset.execute( + TestConstants.TEST_NEW_DATASET_DTO, + testGetDatasetDownloadCountCollectionAlias + ) + await publishDatasetViaApi(testDatasetIds.numericId) await waitForNoLocks(testDatasetIds.numericId, 10) + }) + + afterAll(async () => { + await deletePublishedDatasetViaApi(testDatasetIds.persistentId) + await deleteCollectionViaApi(testGetDatasetDownloadCountCollectionAlias) + }) + + test('should return download count for a dataset', async () => { const actual = await sut.getDatasetDownloadCount(testDatasetIds.numericId) expect(actual.downloadCount).toBe(0) }) test('should return download count including MDC data', async () => { - const testDatasetIds = await createDataset.execute(TestConstants.TEST_NEW_DATASET_DTO) - await publishDatasetViaApi(testDatasetIds.numericId) - await waitForNoLocks(testDatasetIds.numericId, 10) - const actual = await sut.getDatasetDownloadCount(testDatasetIds.numericId, true) expect(actual.downloadCount).toBe(0) }) test('should return download count including MDC data with persistent ID', async () => { - const testDatasetIds = await createDataset.execute(TestConstants.TEST_NEW_DATASET_DTO) - await publishDatasetViaApi(testDatasetIds.numericId) - await waitForNoLocks(testDatasetIds.numericId, 10) - const actual = await sut.getDatasetDownloadCount(testDatasetIds.persistentId, true) expect(actual.downloadCount).toBe(0) From 20fb1df19b02a898b67f3ea1602e20fbe14a89d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Saracca?= Date: Fri, 28 Mar 2025 09:46:45 -0300 Subject: [PATCH 7/7] remove comment --- test/integration/datasets/DatasetsRepository.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/test/integration/datasets/DatasetsRepository.test.ts b/test/integration/datasets/DatasetsRepository.test.ts index 6013e182..bd71503b 100644 --- a/test/integration/datasets/DatasetsRepository.test.ts +++ b/test/integration/datasets/DatasetsRepository.test.ts @@ -595,7 +595,6 @@ describe('DatasetsRepository', () => { test('should return diff between :latestPublished deaccessioned and :draft when includeDeaccessioned param is true', async () => { await deaccessionDatasetViaApi(testDatasetIds.numericId, '1.0') - // Update dataset const metadataBlocksRepository = new MetadataBlocksRepository() const citationMetadataBlock = await metadataBlocksRepository.getMetadataBlockByName( 'citation'