Updates
This commit is contained in:
@@ -1,14 +1,26 @@
|
||||
require('bare-process/global')
|
||||
const test = require('brittle')
|
||||
const { HyperP2PStreamBackpressure, PROTOCOL } = require('../index.js')
|
||||
|
||||
test('exports load', (t) => {
|
||||
test('exports', (t) => {
|
||||
t.ok(HyperP2PStreamBackpressure)
|
||||
t.is(PROTOCOL, 'stream-backpressure/v1')
|
||||
t.ok(PROTOCOL)
|
||||
})
|
||||
|
||||
test('getStats shape', async (t) => {
|
||||
test('basic operation', async (t) => {
|
||||
const m = new HyperP2PStreamBackpressure()
|
||||
const s = m.getStats()
|
||||
t.is(s.tier, 'scaffold')
|
||||
t.is(s.protocol, 'stream-backpressure/v1')
|
||||
m.write('hi'); t.ok(m.read())
|
||||
await m.close()
|
||||
})
|
||||
|
||||
test('validation', async (t) => {
|
||||
const m = new HyperP2PStreamBackpressure()
|
||||
try { m.write(null) } catch (e) { t.ok(e) }
|
||||
await m.close()
|
||||
})
|
||||
|
||||
test('getStats', async (t) => {
|
||||
const m = new HyperP2PStreamBackpressure()
|
||||
t.ok(m.getStats().protocol)
|
||||
await m.close()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user