fix(test): improve test isolation and reduce noise in unit tests
- Add logger/error-utils mocks to cleaner-handler test to suppress IPC error log noise - Move setupServiceMocks into beforeEach for consistent default mocking in cleaner tests - Replace vi.waitFor (2s timeout) with setImmediate microtask flush in extractor test - Remove dead activeType assignments in validation-database test - Align TestUser.id type with UserInfo.id (string → number) and use deterministic counter Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -120,8 +120,14 @@ describe('ExtractorService', () => {
|
||||
})
|
||||
|
||||
it('should ensure download directory exists', async () => {
|
||||
// Clear fs.mkdir mock history before creating instance
|
||||
vi.mocked(fs.mkdir).mockClear()
|
||||
|
||||
// Create instance (constructor calls fs.mkdir asynchronously)
|
||||
new ExtractorService(mockAuthService, './test-downloads')
|
||||
|
||||
// Flush microtask queue so constructor's async mkdir resolves
|
||||
await new Promise((resolve) => setImmediate(resolve))
|
||||
expect(fs.mkdir).toHaveBeenCalledWith('./test-downloads', { recursive: true })
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user