feat: import job runner in-memory
- Añade ImportRunner en memoria con concurrencia configurable - Tests TDD para enqueue, concurrencia y comportamiento tras stop - Actualiza /api/import/scan para encolar jobs y registrar errores - Ajusta tsconfig.json para incluir tests en comprobaciones de tipo
This commit is contained in:
28
backend/tests/services/fsScanner.spec.ts
Normal file
28
backend/tests/services/fsScanner.spec.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import path from 'path';
|
||||
import { scanDirectory } from '../../src/services/fsScanner';
|
||||
|
||||
const fixturesDir = path.join(__dirname, '..', 'fixtures');
|
||||
const emptyDir = path.join(fixturesDir, 'empty');
|
||||
|
||||
describe('services/fsScanner', () => {
|
||||
it('exporta scanDirectory', () => {
|
||||
expect(typeof scanDirectory).toBe('function');
|
||||
});
|
||||
|
||||
it('carpeta vacía devuelve array', async () => {
|
||||
const res = await scanDirectory(emptyDir);
|
||||
expect(Array.isArray(res)).toBe(true);
|
||||
expect((res as any[]).length).toBe(0);
|
||||
});
|
||||
|
||||
it('detecta simple-rom.bin', async () => {
|
||||
const res = await scanDirectory(fixturesDir);
|
||||
const found = (res as any[]).find(
|
||||
(r: any) => r.filename === 'simple-rom.bin' || r.name === 'simple-rom.bin'
|
||||
);
|
||||
expect(found).toBeTruthy();
|
||||
expect(found.size).toBeGreaterThan(0);
|
||||
expect(found.format).toBeDefined();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user