Updates
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
require('bare-process/global')
|
||||
const test = require('brittle')
|
||||
const { HyperP2PCongestionSignal } = require('../index.js')
|
||||
|
||||
test('hyper-p2p-congestion-signal: basic operation', async (t) => {
|
||||
const m = new HyperP2PCongestionSignal()
|
||||
m.reportSample('p1', 50, 0.1)
|
||||
t.ok(m.getHint('p1').sendRateBps > 0)
|
||||
await m.close()
|
||||
})
|
||||
|
||||
test('hyper-p2p-congestion-signal: validation', async (t) => {
|
||||
const m = new HyperP2PCongestionSignal()
|
||||
try {
|
||||
m.reportSample(null, -1, 0)
|
||||
t.fail('expected throw')
|
||||
} catch (e) {
|
||||
t.ok(e instanceof Error)
|
||||
}
|
||||
await m.close()
|
||||
})
|
||||
|
||||
test('hyper-p2p-congestion-signal: getStats', async (t) => {
|
||||
const m = new HyperP2PCongestionSignal()
|
||||
const s = m.getStats()
|
||||
t.ok(s)
|
||||
await m.close()
|
||||
})
|
||||
|
||||
test('hyper-p2p-congestion-signal: close idempotent', async (t) => {
|
||||
const m = new HyperP2PCongestionSignal()
|
||||
await m.close()
|
||||
await m.close()
|
||||
t.pass()
|
||||
})
|
||||
Reference in New Issue
Block a user