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:
2026-02-08 22:24:56 +01:00
parent 1a42422c7e
commit 4298b003d9
20 changed files with 696 additions and 1 deletions

View File

@@ -0,0 +1,35 @@
import { describe, it, expect } from 'vitest';
import path from 'path';
import fs from 'fs';
import { parseDat, verifyRomAgainstDat } from '../../src/services/datVerifier';
const fixturesDir = path.join(__dirname, '..', 'fixtures');
const datPath = path.join(fixturesDir, 'dats', 'sample-no-intro.dat.xml');
const simpleRom = path.join(fixturesDir, 'simple-rom.bin');
const runIntegration = !!process.env.INTEGRATION;
const describeIf = runIntegration ? describe : describe.skip;
describeIf('services/datVerifier', () => {
it('parsea DAT xml', () => {
const xml = fs.readFileSync(datPath, 'utf8');
const parsed = parseDat(xml);
expect(parsed).toBeDefined();
});
it('verifica rom contra DAT', async () => {
const stats = fs.statSync(simpleRom);
const romMeta = {
filename: 'simple-rom.bin',
size: stats.size,
md5: 'placeholder',
sha1: 'placeholder',
crc32: 'placeholder',
} as any;
const xml = fs.readFileSync(datPath, 'utf8');
const parsed = parseDat(xml);
const res = await verifyRomAgainstDat(romMeta, parsed);
expect(res).toBeDefined();
});
});