tests: use at.least to compare dates on the hlc tests.

This commit is contained in:
Alexis Métaireau 2024-10-04 22:46:33 +02:00
parent 16b759973b
commit 979d34f3fa
No known key found for this signature in database
GPG key ID: 1C21B876828E5FF2

View file

@ -81,7 +81,7 @@ describe('HybridLogicalClock', () => {
const now = Date.now()
clock = new HybridLogicalClock(now, 5, 'local')
const result = clock.receive(`${now}:7:remote`)
expect(result.walltime).to.equal(now)
expect(result.walltime).to.be.at.least(now)
expect(result.nn).to.equal(8)
expect(result.id).to.equal('local')
})
@ -117,7 +117,7 @@ describe('HybridLogicalClock', () => {
const event2 = hlc.tick()
// Simulate receiving a message from another node
const remoteEvent = hlc.receive(`${Date.now() - 50}:5:remote-id`)
hlc.receive(`${Date.now() - 50}:5:remote-id`)
const event3 = hlc.tick()