Skip to content

Commit

Permalink
fix: Fix test. Odd that it worked before, because it was clearly wron…
Browse files Browse the repository at this point in the history
…g. Probably has to do with the update to a newer @sphereon/ssi-types
  • Loading branch information
nklomp committed Mar 19, 2024
1 parent 3c41395 commit 29d5c33
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/PEX.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,11 @@ describe('evaluate', () => {

it('should throw an error if expiration date and exp are different in JWT vc', () => {
const jwtVc: IVerifiableCredential = getFileAsJson('test/dif_pe_examples/vp/vp_general.json').verifiableCredential[0];
const now = new Date();
jwtVc['exp'] = now.valueOf();
jwtVc['vc'].expirationDate = new Date(now.getTime() + 2000).toString();
expect(() => SSITypesBuilder.mapExternalVerifiableCredentialsToWrappedVcs([jwtVc])).toThrowError(
`Inconsistent expiration dates between JWT claim (${new Date(jwtVc['exp']).toISOString()}) and VC value (${jwtVc['vc'].expirationDate})`,
const now = Date.now();
jwtVc['exp'] = now / 1000;
jwtVc['vc'].expirationDate = new Date(now + 2000).toISOString();
expect(() => SSITypesBuilder.mapExternalVerifiableCredentialsToWrappedVcs([jwtVc])).toThrow(
`Inconsistent expiration dates between JWT claim (${new Date(jwtVc['exp'] * 1000).toISOString().replace(/\.[0-9]+Z/, 'Z')}) and VC value (${jwtVc['vc'].expirationDate})`,
);
});

Expand Down

0 comments on commit 29d5c33

Please sign in to comment.