|
|
@@ -258,11 +258,12 @@ describe('File API Integration Tests', () => {
|
|
|
describe('POST /api/v1/files/multipart-policy', () => {
|
|
|
it('should generate multipart upload policy successfully', async () => {
|
|
|
const mockRequestData = {
|
|
|
+ fileKey: 'large-file.zip',
|
|
|
+ totalSize: 1024 * 1024 * 100, // 100MB
|
|
|
+ partSize: 1024 * 1024 * 20, // 20MB
|
|
|
name: 'large-file.zip',
|
|
|
type: 'application/zip',
|
|
|
- size: 1024 * 1024 * 100, // 100MB
|
|
|
- uploadUserId: 1,
|
|
|
- partCount: 5
|
|
|
+ uploadUserId: 1
|
|
|
};
|
|
|
|
|
|
const mockResponse = {
|
|
|
@@ -270,9 +271,13 @@ describe('File API Integration Tests', () => {
|
|
|
id: 1,
|
|
|
...mockRequestData,
|
|
|
path: '1/test-uuid-123-large-file.zip',
|
|
|
+ description: null,
|
|
|
+ uploadUser: {} as any,
|
|
|
uploadTime: new Date(),
|
|
|
+ lastUpdated: null,
|
|
|
createdAt: new Date(),
|
|
|
- updatedAt: 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'],
|
|
|
@@ -308,7 +313,7 @@ describe('File API Integration Tests', () => {
|
|
|
it('should validate multipart policy request data', async () => {
|
|
|
const invalidData = {
|
|
|
name: 'test.zip',
|
|
|
- // Missing required fields
|
|
|
+ // Missing required fields: fileKey, totalSize, partSize
|
|
|
};
|
|
|
|
|
|
const response = await client.files['multipart-policy'].$post({
|
|
|
@@ -363,7 +368,7 @@ describe('File API Integration Tests', () => {
|
|
|
it('should validate complete multipart request data', async () => {
|
|
|
const invalidData = {
|
|
|
uploadId: 'upload-123',
|
|
|
- // Missing required fields
|
|
|
+ // Missing required fields: bucket, key, parts
|
|
|
};
|
|
|
|
|
|
const response = await client.files['multipart-complete'].$post({
|
|
|
@@ -420,7 +425,7 @@ describe('File API Integration Tests', () => {
|
|
|
}
|
|
|
];
|
|
|
|
|
|
- vi.spyOn(mockFileService, 'getList').mockResolvedValue(mockFiles as File[]);
|
|
|
+ vi.spyOn(mockFileService, 'getList').mockResolvedValue([mockFiles as File[], mockFiles.length]);
|
|
|
|
|
|
const response = await client.files.$get({
|
|
|
query: {}
|
|
|
@@ -472,7 +477,7 @@ describe('File API Integration Tests', () => {
|
|
|
}
|
|
|
];
|
|
|
|
|
|
- vi.spyOn(mockFileService, 'getList').mockResolvedValue(mockFiles as File[]);
|
|
|
+ vi.spyOn(mockFileService, 'getList').mockResolvedValue([mockFiles as File[], mockFiles.length]);
|
|
|
|
|
|
const response = await client.files.$get({
|
|
|
query: { keyword: 'document' }
|