Skip to content

Commit eed1e8c

Browse files
committed
Add test for older DOI format
More info: https://www.crossref.org/blog/dois-and-matching-regular-expressions/ This test ensures roughly 300000 DOIs from Wiley match the regex
1 parent 728a993 commit eed1e8c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

spec/test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ var doi = [
1111
'10.0001/issn.10001'
1212
]
1313

14+
var doiOlderFormat = [
15+
'10.1002/(SICI)1096-8644(199808)106:4<483::AID-AJPA4>3.0.CO;2-K' // one of 300K DOIs from Wiley - see https://www.crossref.org/blog/dois-and-matching-regular-expressions/ for more info
16+
]
17+
1418
var doiNot = [
1519
'10..1000/journal.pone.0011111',
1620
'1.1/1.1',
@@ -65,6 +69,13 @@ test('exact DOIs as passing', function (t) {
6569
t.end()
6670
})
6771

72+
test('older format DOIs as passing', function (t) {
73+
_(doiOlderFormat).each(function (el) {
74+
t.assert(doiRegex({exact: true}).test(el), el)
75+
})
76+
t.end()
77+
})
78+
6879
test('embeded DOIs as passing', function (t) {
6980
_(doi).each(function (el) {
7081
t.assert(doiRegex().exec('foo' + el)[0] === el, el)

0 commit comments

Comments
 (0)