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:
35
backend/tests/services/datVerifier.spec.ts
Normal file
35
backend/tests/services/datVerifier.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user