|
|
@@ -316,15 +316,28 @@ describe('File API Integration Tests', () => {
|
|
|
uploadUserId: 1
|
|
|
};
|
|
|
|
|
|
- const mockResponse = {
|
|
|
+ const mockServiceResponse = {
|
|
|
+ file: {
|
|
|
+ id: 1,
|
|
|
+ name: 'large-file.zip',
|
|
|
+ type: 'application/zip',
|
|
|
+ size: 104857600,
|
|
|
+ uploadUserId: 1,
|
|
|
+ path: '1/test-uuid-123-large-file.zip',
|
|
|
+ description: null,
|
|
|
+ uploadTime: new Date(),
|
|
|
+ lastUpdated: null,
|
|
|
+ createdAt: new Date(),
|
|
|
+ updatedAt: new Date(),
|
|
|
+ fullUrl: Promise.resolve('https://minio.example.com/d8dai/1/test-uuid-123-large-file.zip')
|
|
|
+ },
|
|
|
uploadId: 'upload-123',
|
|
|
+ uploadUrls: ['url1', 'url2', 'url3', 'url4', 'url5'],
|
|
|
bucket: 'd8dai',
|
|
|
- key: '1/test-uuid-123-large-file.zip',
|
|
|
- host: 'http://undefined:undefined',
|
|
|
- partUrls: ['url1', 'url2', 'url3', 'url4', 'url5']
|
|
|
+ key: '1/test-uuid-123-large-file.zip'
|
|
|
};
|
|
|
|
|
|
- const mockCreateMultipartUploadPolicy = vi.fn().mockResolvedValue(mockResponse);
|
|
|
+ const mockCreateMultipartUploadPolicy = vi.fn().mockResolvedValue(mockServiceResponse);
|
|
|
vi.mocked(FileService).mockImplementation(() => ({
|
|
|
createMultipartUploadPolicy: mockCreateMultipartUploadPolicy
|
|
|
} as unknown as FileService));
|
|
|
@@ -340,7 +353,13 @@ describe('File API Integration Tests', () => {
|
|
|
|
|
|
expect(response.status).toBe(200);
|
|
|
const result = await response.json();
|
|
|
- expect(result).toEqual(mockResponse);
|
|
|
+ expect(result).toEqual({
|
|
|
+ uploadId: 'upload-123',
|
|
|
+ bucket: 'd8dai',
|
|
|
+ key: '1/test-uuid-123-large-file.zip',
|
|
|
+ host: 'http://undefined:undefined',
|
|
|
+ partUrls: ['url1', 'url2', 'url3', 'url4', 'url5']
|
|
|
+ });
|
|
|
expect(mockCreateMultipartUploadPolicy).toHaveBeenCalledWith(
|
|
|
{
|
|
|
fileKey: 'large-file.zip',
|