refactor: update S3StorageAdapter tests to use public URL for object retrieval
Some checks failed
Build and Test / run-test (20.x) (push) Failing after 1m41s
Some checks failed
Build and Test / run-test (20.x) (push) Failing after 1m41s
This commit is contained in:
@@ -1,15 +1,20 @@
|
|||||||
import {
|
import { S3StorageAdapter, S3StorageConfig } from '@/lib/storage/storage.adapter';
|
||||||
S3StorageAdapter,
|
import { DeleteObjectCommand, PutObjectCommand, S3Client } from '@aws-sdk/client-s3';
|
||||||
S3StorageConfig,
|
|
||||||
} from '@/lib/storage/storage.adapter';
|
|
||||||
import {
|
|
||||||
DeleteObjectCommand,
|
|
||||||
PutObjectCommand,
|
|
||||||
S3Client,
|
|
||||||
} from '@aws-sdk/client-s3';
|
|
||||||
import * as presigner from '@aws-sdk/s3-request-presigner';
|
import * as presigner from '@aws-sdk/s3-request-presigner';
|
||||||
import { mockClient } from 'aws-sdk-client-mock';
|
import { mockClient } from 'aws-sdk-client-mock';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
jest.mock('@aws-sdk/s3-request-presigner');
|
jest.mock('@aws-sdk/s3-request-presigner');
|
||||||
|
|
||||||
describe('S3StorageAdapter', () => {
|
describe('S3StorageAdapter', () => {
|
||||||
@@ -23,6 +28,7 @@ describe('S3StorageAdapter', () => {
|
|||||||
region: 'us-east-1',
|
region: 'us-east-1',
|
||||||
accessKey: 'test-access-key',
|
accessKey: 'test-access-key',
|
||||||
secretKey: 'test-secret-key',
|
secretKey: 'test-secret-key',
|
||||||
|
publicUrl: 'http://test.com',
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -44,7 +50,7 @@ describe('S3StorageAdapter', () => {
|
|||||||
|
|
||||||
expect(result).toEqual({
|
expect(result).toEqual({
|
||||||
ok: true,
|
ok: true,
|
||||||
value: `http://localhost:9000/test-bucket/${key}`,
|
value: `http://test.com/${key}`,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -55,7 +61,7 @@ describe('S3StorageAdapter', () => {
|
|||||||
|
|
||||||
expect(result).toEqual({
|
expect(result).toEqual({
|
||||||
ok: true,
|
ok: true,
|
||||||
value: `http://localhost:9000/test-bucket/${key}`,
|
value: `http://test.com/${key}`,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user