1import { describe, expect, it } from 'vitest'2import { pikchrAdapter } from '../src/adapters/pikchr'3import type { RenderRequest } from '../src/runtime/types'45const request = (source: string, options: Record<string, string> = {}): RenderRequest => ({6 engine: 'pikchr', source, format: 'svg', options,7 metadata: { title: '', description: '' },8 presentation: { background: '', padding: 0, frame: false },9})1011describe('Pikchr edge-Wasm adapter', () => {12 it('renders the pinned upstream fixture and preserves labels', async () => {13 const result = await pikchrAdapter.render(request('D: diamond "Cardinal" "Points"\n dot ".n" above at D.n'), new AbortController().signal)14 expect(result.runtime).toBe('edge-wasm')15 expect(result.body).toContain('<svg')16 expect(result.body).toContain('Cardinal')17 })1819 it('returns bounded parser errors instead of invalid SVG', async () => {20 await expect(pikchrAdapter.render(request('this is not pikchr {'), new AbortController().signal)).rejects.toMatchObject({ status: 422, code: 'render_failed' })21 })2223 it('rejects options and oversized UTF-8 sources', async () => {24 await expect(pikchrAdapter.render(request('box', { dark: 'true' }), new AbortController().signal)).rejects.toMatchObject({ status: 400, code: 'unsupported_options' })25 await expect(pikchrAdapter.render(request('é'.repeat(140_000)), new AbortController().signal)).rejects.toMatchObject({ status: 413, code: 'source_too_large' })26 })27})