import { readFile } from 'node:fs/promises'; import { dirname, resolve } from 'node:path'; import { fileURLToPath } from 'node:url'; import { afterAll, beforeAll, describe, expect, test } from 'vitest'; import { runPageDeleteConformance, type ConformanceTestRunner, } from '@embedpdf/engine-core/conformance'; import { createLocalEngine } from '../src/index'; const here = dirname(fileURLToPath(import.meta.url)); // `sample.pdf` is multi-page so deletes leave survivors to assert on. const fixturePath = resolve( here, '..', '..', '..', '..', 'examples', 'engine-runtime-demo', 'public', 'sample.pdf', ); const runner: ConformanceTestRunner = { describe, test, beforeAll, afterAll, expect: expect as unknown as ConformanceTestRunner['expect'], }; runPageDeleteConformance(runner, { label: 'engine-local (inline transport, wasm runtime)', openKind: 'bytes', fixture: { id: 'sample-pdf-page-delete', bytes: async () => new Uint8Array(await readFile(fixturePath)), expected: { trapped: 'unknown' }, }, makeEngine: () => createLocalEngine({ runtime: { prefer: 'wasm' } }), });