Skip to content

Commit

Permalink
fix check for session time
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu committed Feb 4, 2024
1 parent 38dc335 commit 8b3f56f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion test/sapphire_devnet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,8 @@ describe("torus utils sapphire devnet", function () {
const parsedSigsData = signatures.map((s) => JSON.parse(atob(s.data)));
parsedSigsData.forEach((ps) => {
const sessionTime = ps.exp - Math.floor(Date.now() / 1000);
expect(sessionTime).eql(customSessionTime);
const sessionTimeVariance = customSessionTime - sessionTime <= 1; // there can be some variance of 1 sec as we are doing floor op here.
expect(sessionTimeVariance).eql(true);
});
});

Expand Down
5 changes: 3 additions & 2 deletions test/sapphire_mainnet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const TORUS_TEST_AGGREGATE_VERIFIER = "torus-aggregate-sapphire-mainnet";
const HashEnabledVerifier = "torus-test-verifierid-hash";
const TORUS_EXTENDED_VERIFIER_EMAIL = "[email protected]";

describe.only("torus utils sapphire mainnet", function () {
describe("torus utils sapphire mainnet", function () {
let torus: TorusUtils;
let TORUS_NODE_MANAGER: NodeManager;

Expand Down Expand Up @@ -386,7 +386,8 @@ describe.only("torus utils sapphire mainnet", function () {
const parsedSigsData = signatures.map((s) => JSON.parse(atob(s.data)));
parsedSigsData.forEach((ps) => {
const sessionTime = ps.exp - Math.floor(Date.now() / 1000);
expect(sessionTime).eql(customSessionTime);
const sessionTimeVariance = customSessionTime - sessionTime <= 1; // there can be some variance of 1 sec as we are doing floor op here.
expect(sessionTimeVariance).eql(true);
});
});
});

0 comments on commit 8b3f56f

Please sign in to comment.