Skip to content

Commit

Permalink
Add test for validFrom & validUntil same time.
Browse files Browse the repository at this point in the history
  • Loading branch information
aljones15 committed Dec 1, 2023
1 parent fb9791b commit 1491531
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/10-verify.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,22 @@ for(const [version, mockCredential] of versionedCredentials) {
should.not.exist(error,
'Should NOT throw when now is between "validFrom" & "validUntil"');
});
it('should accept if "validFrom" & "validUntil" are the same time',
() => {
const credential = jsonld.clone(mockCredential);
credential.issuer = 'did:example:12345';
const now = '2022-06-30T19:21:25Z';
credential.validFrom = now;
credential.validUntil = now;
let error;
try {
vc._checkCredential({credential, now});
} catch(e) {
error = e;
}
should.not.exist(error, 'Should NOT throw when now is between' +
'"validFrom" & "validUntil"');
});
it('should reject if now is after "validFrom" & "validUntil"', () => {
const credential = jsonld.clone(mockCredential);
credential.issuer = 'did:example:12345';
Expand Down

0 comments on commit 1491531

Please sign in to comment.