Skip to content

Commit ac769f7

Browse files
committed
fix:remove empty then() and console.log() statements
1 parent b0ce7db commit ac769f7

File tree

1 file changed

+25
-47
lines changed

1 file changed

+25
-47
lines changed

test/integration/files/FilesRepository.test.ts

Lines changed: 25 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -59,42 +59,26 @@ describe('FilesRepository', () => {
5959
// Uploading test file 1 with some categories
6060
const uploadFileResponse = await uploadFileViaApi(testDatasetIds.numericId, testTextFile1Name, {
6161
categories: [testCategoryName]
62+
}).catch(() => {
63+
throw new Error(`Tests beforeAll(): Error while uploading file ${testTextFile1Name}`)
6264
})
63-
.then()
64-
.catch((e) => {
65-
console.log(e)
66-
throw new Error(`Tests beforeAll(): Error while uploading file ${testTextFile1Name}`)
67-
})
6865
// Uploading test file 2
69-
await uploadFileViaApi(testDatasetIds.numericId, testTextFile2Name)
70-
.then()
71-
.catch((e) => {
72-
console.log(e)
73-
throw new Error(`Tests beforeAll(): Error while uploading file ${testTextFile2Name}`)
74-
})
66+
await uploadFileViaApi(testDatasetIds.numericId, testTextFile2Name).catch(() => {
67+
throw new Error(`Tests beforeAll(): Error while uploading file ${testTextFile2Name}`)
68+
})
7569
// Uploading test file 3
76-
await uploadFileViaApi(testDatasetIds.numericId, testTextFile3Name)
77-
.then()
78-
.catch((e) => {
79-
console.log(e)
80-
throw new Error(`Tests beforeAll(): Error while uploading file ${testTextFile3Name}`)
81-
})
70+
await uploadFileViaApi(testDatasetIds.numericId, testTextFile3Name).catch(() => {
71+
throw new Error(`Tests beforeAll(): Error while uploading file ${testTextFile3Name}`)
72+
})
8273
// Uploading test file 4
83-
await uploadFileViaApi(testDatasetIds.numericId, testTabFile4Name)
84-
.then()
85-
.catch((e) => {
86-
console.log(e)
87-
throw new Error(`Tests beforeAll(): Error while uploading file ${testTabFile4Name}`)
88-
})
74+
await uploadFileViaApi(testDatasetIds.numericId, testTabFile4Name).catch(() => {
75+
throw new Error(`Tests beforeAll(): Error while uploading file ${testTabFile4Name}`)
76+
})
8977
// Registering test file 1
9078

91-
await registerFileViaApi(uploadFileResponse.data.data.files[0].dataFile.id)
92-
.then()
93-
.catch((err) => {
94-
console.log(err.message)
95-
console.log(err.response.data)
96-
throw new Error(`Tests beforeAll(): Error while registering file ${testTextFile1Name}`)
97-
})
79+
await registerFileViaApi(uploadFileResponse.data.data.files[0].dataFile.id).catch(() => {
80+
throw new Error(`Tests beforeAll(): Error while registering file ${testTextFile1Name}`)
81+
})
9882
const filesSubset = await sut.getDatasetFiles(
9983
testDatasetIds.numericId,
10084
latestDatasetVersionId,
@@ -551,23 +535,17 @@ describe('FilesRepository', () => {
551535
})
552536

553537
test('should return citation when dataset is deaccessioned', async () => {
554-
await publishDatasetViaApi(testDatasetIds.numericId)
555-
.then()
556-
.catch(() => {
557-
throw new Error('Error while publishing test Dataset')
558-
})
559-
560-
await waitForNoLocks(testDatasetIds.numericId, 10)
561-
.then()
562-
.catch(() => {
563-
throw new Error('Error while waiting for no locks')
564-
})
565-
566-
await deaccessionDatasetViaApi(testDatasetIds.numericId, '1.0')
567-
.then()
568-
.catch(() => {
569-
throw new Error('Error while deaccessioning test Dataset')
570-
})
538+
await publishDatasetViaApi(testDatasetIds.numericId).catch(() => {
539+
throw new Error('Error while publishing test Dataset')
540+
})
541+
542+
await waitForNoLocks(testDatasetIds.numericId, 10).catch(() => {
543+
throw new Error('Error while waiting for no locks')
544+
})
545+
546+
await deaccessionDatasetViaApi(testDatasetIds.numericId, '1.0').catch(() => {
547+
throw new Error('Error while deaccessioning test Dataset')
548+
})
571549

572550
const actualFileCitation = await sut.getFileCitation(
573551
testFileId,

0 commit comments

Comments
 (0)