Skip to content

Commit bd65172

Browse files
committed
Add additional pairwise validUntil test assertions.
1 parent 5d9fffa commit bd65172

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

test/mocha/20-tokens.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import crypto from 'node:crypto';
1414
import {encode} from 'base58-universal';
1515
import sinon from 'sinon';
1616

17+
const DEFAULT_BATCH_TTL = 240 * 24 * 60 * 60 * 1000;
1718
const MAX_EXPIRATION_DATE = new Date('9000-01-01T00:00:00Z');
1819
const MAX_UINT32 = 4294967295;
1920

@@ -355,6 +356,8 @@ describe('Tokens', function() {
355356
assertNoError(err);
356357
areTokens(tks);
357358
should.exist(result.pairwiseToken);
359+
result.validUntil.should.be.lt(
360+
new Date(Date.now() + DEFAULT_BATCH_TTL + 60000));
358361
});
359362
it('should resolve token when called twice with same "requester"',
360363
async function() {
@@ -384,6 +387,9 @@ describe('Tokens', function() {
384387
should.exist(result2.pairwiseToken);
385388
result1.pairwiseToken.should.eql(result2.pairwiseToken);
386389
result2.internalId.should.eql(internalId);
390+
const maxDate = new Date(Date.now() + DEFAULT_BATCH_TTL + 60000);
391+
result1.validUntil.should.be.lt(maxDate);
392+
result2.validUntil.should.be.lt(maxDate);
387393
});
388394
it('should resolve token when pairwise token has expired w/same "requester"',
389395
async function() {

0 commit comments

Comments
 (0)