- 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
29 lines
920 B
TypeScript
29 lines
920 B
TypeScript
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();
|
|
});
|
|
});
|