Skip to content

Commit bb6e740

Browse files
committed
test: delete datasets and collection used in get download count test
1 parent 54fb967 commit bb6e740

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

test/integration/datasets/DatasetsRepository.test.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,30 +1293,39 @@ describe('DatasetsRepository', () => {
12931293
})
12941294

12951295
describe('getDatasetDownloadCount', () => {
1296-
test('should return download count for a dataset', async () => {
1297-
const testDatasetIds = await createDataset.execute(TestConstants.TEST_NEW_DATASET_DTO)
1296+
const testGetDatasetDownloadCountCollectionAlias = 'testGetDatasetDownloadCountCollection'
1297+
let testDatasetIds: CreatedDatasetIdentifiers
1298+
1299+
beforeAll(async () => {
1300+
await createCollectionViaApi(testGetDatasetDownloadCountCollectionAlias)
1301+
await publishCollectionViaApi(testGetDatasetDownloadCountCollectionAlias)
1302+
testDatasetIds = await createDataset.execute(
1303+
TestConstants.TEST_NEW_DATASET_DTO,
1304+
testGetDatasetDownloadCountCollectionAlias
1305+
)
1306+
12981307
await publishDatasetViaApi(testDatasetIds.numericId)
12991308
await waitForNoLocks(testDatasetIds.numericId, 10)
1309+
})
1310+
1311+
afterAll(async () => {
1312+
await deletePublishedDatasetViaApi(testDatasetIds.persistentId)
1313+
await deleteCollectionViaApi(testGetDatasetDownloadCountCollectionAlias)
1314+
})
1315+
1316+
test('should return download count for a dataset', async () => {
13001317
const actual = await sut.getDatasetDownloadCount(testDatasetIds.numericId)
13011318

13021319
expect(actual.downloadCount).toBe(0)
13031320
})
13041321

13051322
test('should return download count including MDC data', async () => {
1306-
const testDatasetIds = await createDataset.execute(TestConstants.TEST_NEW_DATASET_DTO)
1307-
await publishDatasetViaApi(testDatasetIds.numericId)
1308-
await waitForNoLocks(testDatasetIds.numericId, 10)
1309-
13101323
const actual = await sut.getDatasetDownloadCount(testDatasetIds.numericId, true)
13111324

13121325
expect(actual.downloadCount).toBe(0)
13131326
})
13141327

13151328
test('should return download count including MDC data with persistent ID', async () => {
1316-
const testDatasetIds = await createDataset.execute(TestConstants.TEST_NEW_DATASET_DTO)
1317-
await publishDatasetViaApi(testDatasetIds.numericId)
1318-
await waitForNoLocks(testDatasetIds.numericId, 10)
1319-
13201329
const actual = await sut.getDatasetDownloadCount(testDatasetIds.persistentId, true)
13211330

13221331
expect(actual.downloadCount).toBe(0)

0 commit comments

Comments
 (0)