Skip to content

Commit

Permalink
fix: testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengShi-1 committed Jan 31, 2025
1 parent 8c19b88 commit e040e7f
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions test/integration/files/FilesRepository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -648,30 +648,40 @@ describe('FilesRepository', () => {
})

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

const actual = await sut.updateFileMetadata(testFileId, testFileMetadata)

expect(actual).toBeUndefined()
await expect(sut.updateFileMetadata(nonExistentFiledId, testFileMetadata)).rejects.toThrow(
errorExpected
)
})

test('should return error when file does not exist', async () => {
const nonExistentFiledId = 4000
test('should update file metadata when file exists', async () => {
const getDatasetFilesResponse = await sut.getDatasetFiles(
testDatasetIds.numericId,
latestDatasetVersionId,
false,
FileOrderCriteria.NAME_AZ
)

console.log('fileInfo', getDatasetFilesResponse)

const fileId = getDatasetFilesResponse.files[0].id
const testFileMetadata = {
description: 'My description bbb.',
categories: ['Data'],
restrict: false
}
const errorExpected = new WriteError(`[400] Error attempting get the requested data file.`)

await expect(sut.updateFileMetadata(nonExistentFiledId, testFileMetadata)).rejects.toThrow(
errorExpected
)
const actual = await sut.updateFileMetadata(fileId, testFileMetadata)

expect(actual).toBeUndefined()
})
})
})

0 comments on commit e040e7f

Please sign in to comment.