-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract dateRegex tests to separate file.
- Loading branch information
1 parent
14da26b
commit ebcf94b
Showing
6 changed files
with
39 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/*! | ||
* Copyright (c) 2019-2021 Digital Bazaar, Inc. All rights reserved. | ||
*/ | ||
const chai = require('chai'); | ||
chai.should(); | ||
|
||
const vc = require('..'); | ||
|
||
describe('verifies RFC3339 Dates', function() { | ||
it('verify a valid date', function() { | ||
const latest = new Date().toISOString(); | ||
vc.dateRegex.test(latest).should.be.true; | ||
}); | ||
it('verify a valid date with lowercase t', function() { | ||
const latest = new Date().toISOString().toLowerCase(); | ||
vc.dateRegex.test(latest).should.be.true; | ||
}); | ||
|
||
it('should not verify an invalid date', function() { | ||
const invalid = '2017/09/27'; | ||
vc.dateRegex.test(invalid).should.be.false; | ||
}); | ||
it('should not verify 2 digit years', function() { | ||
const invalid = '17-09-27T22:07:22.563z'; | ||
vc.dateRegex.test(invalid).should.be.false; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/* eslint-disable */ | ||
module.exports = { | ||
"@context": [ | ||
"https://w3id.org/did/v0.11", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/* eslint-disable */ | ||
const constants = require('../constants'); | ||
|
||
const mock = {}; | ||
|