Compare commits
1 Commits
fc9d96f242
...
93759190be
| Author | SHA1 | Date | |
|---|---|---|---|
|
93759190be
|
@@ -1,7 +1,4 @@
|
||||
import {
|
||||
S3StorageAdapter,
|
||||
S3StorageConfig,
|
||||
} from '@/lib/storage/storage.adapter';
|
||||
import { S3StorageAdapter, S3StorageConfig } from '@/lib/storage/storage.adapter';
|
||||
import {
|
||||
DeleteObjectCommand,
|
||||
PutObjectCommand,
|
||||
@@ -69,16 +66,11 @@ describe('S3StorageAdapter', () => {
|
||||
|
||||
await adapter.put(key, 'image/jpeg');
|
||||
|
||||
const [, command] = jest.mocked(presigner.getSignedUrl).mock
|
||||
.calls[0];
|
||||
const [, command] = jest.mocked(presigner.getSignedUrl).mock.calls[0];
|
||||
expect(command).toBeInstanceOf(PutObjectCommand);
|
||||
expect((command as PutObjectCommand).input.Bucket).toBe(
|
||||
'test-bucket'
|
||||
);
|
||||
expect((command as PutObjectCommand).input.Bucket).toBe('test-bucket');
|
||||
expect((command as PutObjectCommand).input.Key).toBe(key);
|
||||
expect((command as PutObjectCommand).input.ContentType).toBe(
|
||||
'image/jpeg'
|
||||
);
|
||||
expect((command as PutObjectCommand).input.ContentType).toBe('image/jpeg');
|
||||
});
|
||||
|
||||
it('should use 3600 second expiry', async () => {
|
||||
@@ -88,8 +80,7 @@ describe('S3StorageAdapter', () => {
|
||||
|
||||
await adapter.put('test-image.jpg', 'image/jpeg');
|
||||
|
||||
const [, , options] = jest.mocked(presigner.getSignedUrl).mock
|
||||
.calls[0];
|
||||
const [, , options] = jest.mocked(presigner.getSignedUrl).mock.calls[0];
|
||||
expect(options).toEqual({ expiresIn: 3600 });
|
||||
});
|
||||
|
||||
@@ -103,8 +94,7 @@ describe('S3StorageAdapter', () => {
|
||||
});
|
||||
|
||||
it('should return correct presigned URL for different content types', async () => {
|
||||
const presignedUrl =
|
||||
'https://presigned-url.example.com/my-image.png';
|
||||
const presignedUrl = 'https://presigned-url.example.com/my-image.png';
|
||||
jest.mocked(presigner.getSignedUrl).mockResolvedValue(presignedUrl);
|
||||
|
||||
const result = await adapter.put('my-image.png', 'image/png');
|
||||
|
||||
Reference in New Issue
Block a user