Skip to content

Commit d25aa37

Browse files
committed
remove additional hour for tolerance
1 parent 77ea1c9 commit d25aa37

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/ipns/test/republish.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { dhtRoutingKey, ipnsMetadataKey } from '../src/utils.ts'
1313
import { createIPNS } from './fixtures/create-ipns.js'
1414
import type { IPNS } from '../src/ipns.js'
1515
import type { CreateIPNSResult } from './fixtures/create-ipns.js'
16+
import { REPUBLISH_THRESHOLD } from '../src/constants.ts'
1617

1718
// Helper to await until a stub is called
1819
function waitForStubCall (stub: sinon.SinonStub, callCount = 1): Promise<void> {
@@ -148,8 +149,9 @@ describe('republish', () => {
148149
const record = await createIPNSRecord(key, testCid, 1n, 24 * 60 * 60 * 1000)
149150
const routingKey = multihashToIPNSRoutingKey(key.publicKey.toMultihash())
150151

151-
// create a dht record with a created time < now - REPUBLISH_THRESHOLD
152-
const dhtRecord = new Record(routingKey, marshalIPNSRecord(record), new Date(Date.now() - 24 * 60 * 60 * 1000))
152+
// create a dht record with a timeReceived < now - REPUBLISH_THRESHOLD
153+
const timeReceived = new Date(Date.now() - REPUBLISH_THRESHOLD - 60 * 60 * 1000)
154+
const dhtRecord = new Record(routingKey, marshalIPNSRecord(record), timeReceived)
153155

154156
// Store the dht record and metadata in the real datastore
155157
await result.datastore.put(dhtRoutingKey(routingKey), dhtRecord.serialize())

0 commit comments

Comments
 (0)