|
|
@@ -4,9 +4,11 @@ import { DataSource } from 'typeorm';
|
|
|
import { FileService } from '@/server/modules/files/file.service';
|
|
|
import { authMiddleware } from '@/server/middleware/auth.middleware';
|
|
|
import { fileApiRoutes } from '@/server/api';
|
|
|
+import { AppDataSource } from '@/server/data-source';
|
|
|
|
|
|
vi.mock('@/server/modules/files/file.service');
|
|
|
vi.mock('@/server/middleware/auth.middleware');
|
|
|
+vi.mock('@/server/data-source');
|
|
|
|
|
|
describe('File API Integration Tests', () => {
|
|
|
let client: ReturnType<typeof testClient<typeof fileApiRoutes>>['api']['v1'];
|
|
|
@@ -496,7 +498,7 @@ describe('File API Integration Tests', () => {
|
|
|
}
|
|
|
];
|
|
|
|
|
|
- const mockGetList = vi.fn().mockResolvedValue([mockFiles as File[], mockFiles.length]);
|
|
|
+ const mockGetList = vi.fn().mockResolvedValue([mockFiles as unknown as File[], mockFiles.length]);
|
|
|
vi.mocked(FileService).mockImplementation(() => ({
|
|
|
getList: mockGetList
|
|
|
} as unknown as FileService));
|
|
|
@@ -531,7 +533,7 @@ describe('File API Integration Tests', () => {
|
|
|
uploadUserId: 1
|
|
|
};
|
|
|
|
|
|
- const mockGetById = vi.fn().mockResolvedValue(mockFile as File);
|
|
|
+ const mockGetById = vi.fn().mockResolvedValue(mockFile as unknown as File);
|
|
|
vi.mocked(FileService).mockImplementation(() => ({
|
|
|
getById: mockGetById
|
|
|
} as unknown as FileService));
|
|
|
@@ -566,7 +568,7 @@ describe('File API Integration Tests', () => {
|
|
|
}
|
|
|
];
|
|
|
|
|
|
- const mockGetList = vi.fn().mockResolvedValue([mockFiles as File[], mockFiles.length]);
|
|
|
+ const mockGetList = vi.fn().mockResolvedValue([mockFiles as unknown as File[], mockFiles.length]);
|
|
|
vi.mocked(FileService).mockImplementation(() => ({
|
|
|
getList: mockGetList
|
|
|
} as unknown as FileService));
|