Skip to content

Commit e040e7f

Browse files
committed
fix: testcase
1 parent 8c19b88 commit e040e7f

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

test/integration/files/FilesRepository.test.ts

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -648,30 +648,40 @@ describe('FilesRepository', () => {
648648
})
649649

650650
describe('updateFileMetadata', () => {
651-
test('should update file metadata when file exists', async () => {
651+
test('should return error when file does not exist', async () => {
652+
const nonExistentFiledId = 4000
652653
const testFileMetadata = {
653654
description: 'My description bbb.',
654655
categories: ['Data'],
655656
restrict: false
656657
}
658+
const errorExpected = new WriteError(`[400] Error attempting get the requested data file.`)
657659

658-
const actual = await sut.updateFileMetadata(testFileId, testFileMetadata)
659-
660-
expect(actual).toBeUndefined()
660+
await expect(sut.updateFileMetadata(nonExistentFiledId, testFileMetadata)).rejects.toThrow(
661+
errorExpected
662+
)
661663
})
662664

663-
test('should return error when file does not exist', async () => {
664-
const nonExistentFiledId = 4000
665+
test('should update file metadata when file exists', async () => {
666+
const getDatasetFilesResponse = await sut.getDatasetFiles(
667+
testDatasetIds.numericId,
668+
latestDatasetVersionId,
669+
false,
670+
FileOrderCriteria.NAME_AZ
671+
)
672+
673+
console.log('fileInfo', getDatasetFilesResponse)
674+
675+
const fileId = getDatasetFilesResponse.files[0].id
665676
const testFileMetadata = {
666677
description: 'My description bbb.',
667678
categories: ['Data'],
668679
restrict: false
669680
}
670-
const errorExpected = new WriteError(`[400] Error attempting get the requested data file.`)
671681

672-
await expect(sut.updateFileMetadata(nonExistentFiledId, testFileMetadata)).rejects.toThrow(
673-
errorExpected
674-
)
682+
const actual = await sut.updateFileMetadata(fileId, testFileMetadata)
683+
684+
expect(actual).toBeUndefined()
675685
})
676686
})
677687
})

0 commit comments

Comments
 (0)