Skip to content

Commit

Permalink
test(s3): improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
LoneRifle committed Mar 7, 2024
1 parent e24a81a commit f728413
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/__tests__/s3.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,23 @@ describe('S3Service', () => {
'Moved document in s3',
)
})

it('should throw on bad versionId from S3 client', async () => {
// Arrange
mockS3Send.mockReturnValue({ VersionId: undefined })
const mockS3Service = new S3Service(testConfig, mockLogger)

// Act and Assert
await expect(
mockS3Service.moveS3File({
sourceBucketName: 'sourceBucketName',
sourceObjectKey: 'sourceObjectKey',
sourceObjectVersionId: 'sourceObjectVersionId',
destinationBucketName: 'destinationBucketName',
destinationObjectKey: 'destinationObjectKey',
}),
).rejects.toThrow(new Error('VersionId is empty'))
})
})
describe('getS3FileStreamWithVersionId', () => {
it('should return file stream with version id', async () => {
Expand Down

0 comments on commit f728413

Please sign in to comment.