/** * Renders the fixture comprobantes to PNG under /fixtures, so the e2e tests scan a real * image rather than a hand built payload. Run with `pnpm fixtures`. */ import { mkdirSync, writeFileSync } from 'node:fs'; import { dirname, join } from 'node:path'; import { fileURLToPath } from 'node:url'; import { FIXTURES } from '../src/db/fixtures'; import { renderKude } from './kude-png'; const here = dirname(fileURLToPath(import.meta.url)); const outputDir = join(here, '..', '..', '..', 'fixtures'); mkdirSync(outputDir, { recursive: true }); for (const fixture of FIXTURES) { const png = renderKude(fixture); const target = join(outputDir, `${fixture.name}.png`); writeFileSync(target, png); console.info(`[fixtures] ${target} (${png.byteLength} bytes)${fixture.cdc ? ' with QR' : ' no QR'}`); } console.info(`[fixtures] ${FIXTURES.length} rendered`);