import { test } from '@japa/runner' import { fromWire, type WireBatch } from '#lib/edge/index' test.group('edge / wire', () => { test('fromWire drops NUL from strings, wherever they are', ({ assert }) => { const wire = { from: 1, next: 2, headers: 1, releases: [{ key: 'k', name: 'Brutal.ra\u0000r', payload: Buffer.from('x').toString('base64') }], samples: [], candidates: [], counts: [], fragments: [{ fileKey: 'f', segments: [['a\u0000b.rar', 1, 2, 3]] }], } as unknown as WireBatch const batch = fromWire(wire) as any assert.equal(batch.releases[0].name, 'Brutal.rar') assert.equal(batch.releases[0].payload.toString(), 'x') assert.equal(batch.fragments[0].segments[0][0], 'ab.rar') assert.equal(batch.fragments[0].segments[0][3], 3) }) })