diff --git a/packages/core/test/pairing.spec.ts b/packages/core/test/pairing.spec.ts index f6e9dc11d..b2279e306 100644 --- a/packages/core/test/pairing.spec.ts +++ b/packages/core/test/pairing.spec.ts @@ -2,7 +2,8 @@ import { expect, describe, it, beforeEach, afterEach } from "vitest"; import { ICore } from "@walletconnect/types"; import { Core, CORE_PROTOCOL, CORE_VERSION, PAIRING_EVENTS, SUBSCRIBER_EVENTS } from "../src"; import { TEST_CORE_OPTIONS, disconnectSocket, waitForEvent } from "./shared"; -import { generateRandomBytes32, parseUri, toBase64 } from "@walletconnect/utils"; +import { calcExpiry, generateRandomBytes32, parseUri, toBase64 } from "@walletconnect/utils"; +import { FIVE_MINUTES, ONE_MINUTE } from "@walletconnect/time"; const createCoreClients: () => Promise<{ coreA: ICore; coreB: ICore }> = async () => { const coreA = new Core(TEST_CORE_OPTIONS); @@ -121,8 +122,13 @@ describe("Pairing", () => { const inactivePairing = coreA.pairing.pairings.get(topic); expect(inactivePairing.active).toBe(false); await coreA.pairing.activate({ topic }); - expect(coreA.pairing.pairings.get(topic).active).toBe(true); - expect(coreA.pairing.pairings.get(topic).expiry > inactivePairing.expiry).toBe(true); + const activePairing = coreA.pairing.pairings.get(topic); + expect(activePairing.active).toBe(true); + expect(activePairing.expiry > inactivePairing.expiry).toBe(false); + // inactive pairing should have an expiry of 5 minutes + expect(inactivePairing.expiry).to.be.approximately(calcExpiry(FIVE_MINUTES), 5); + // active pairing should have an expiry of 1 minute + expect(activePairing.expiry).to.be.approximately(calcExpiry(ONE_MINUTE), 5); }); });