require('bare-process/global') const test = require('brittle') const { HyperP2PMediaChunker, PROTOCOL } = require('../index.js') test('exports', (t) => { t.ok(HyperP2PMediaChunker) t.is(PROTOCOL, 'media-chunker/v1') }) test('segment and list', async (t) => { const m = new HyperP2PMediaChunker({ chunkSize: 4 }) const chunks = m.segment(Buffer.from('abcdefghij'), { streamId: 's1', keyframe: true }) t.ok(chunks.length >= 2) t.is(m.listChunks('s1').length, chunks.length) t.ok(m.keyframeIndices('s1').length) t.is(m.totalBytes('s1'), 10) await m.close() })