Updates
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
require('bare-process/global')
|
||||
const test = require('brittle')
|
||||
const { HyperP2PParadoxClock } = require('../index.js')
|
||||
|
||||
test('paradox-clock: stamp and resolve', async (t) => {
|
||||
const c = new HyperP2PParadoxClock()
|
||||
const a = c.stamp('e1', { skew: 100000 })
|
||||
const b = c.stamp('e2', { skew: -50000 })
|
||||
const w = c.resolve(a, b)
|
||||
t.ok(w.logical >= 1)
|
||||
await c.close()
|
||||
})
|
||||
|
||||
test('paradox-clock: merge', async (t) => {
|
||||
const a = new HyperP2PParadoxClock()
|
||||
const b = new HyperP2PParadoxClock()
|
||||
a.stamp('evt')
|
||||
b.merge(a.toJSON())
|
||||
t.ok(b.getStamp('evt'))
|
||||
await a.close()
|
||||
await b.close()
|
||||
})
|
||||
test('hyper-p2p-paradox-clock: close without leak', async (t) => {
|
||||
const m = new HyperP2PParadoxClock()
|
||||
await m.close()
|
||||
t.pass()
|
||||
})
|
||||
Reference in New Issue
Block a user