Files
modules/media-streaming/hyper-p2p-media-chunker/test/test.js
T
Raven ScottandCursor ad3fc106f1 Deepen all 20 media-streaming modules with expanded APIs and tests.
Add batch ingest, tree depth/path, peer scoring helpers, scheduler peek, FEC and ABR controls, telemetry sessions, and richer production api.md for bandwidth-aggregator and media-tree-orchestrator.

Co-authored-by: Cursor <[email protected]>
2026-05-21 01:20:48 -04:00

19 lines
577 B
JavaScript

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()
})