Comparing version 1.0.2 to 1.1.0-master-e05556eedaca8d2c7355c50db758af1286e3adca
@@ -7,2 +7,8 @@ # Changelog | ||
## [1.1.0] - 2019-01-17 | ||
### New features | ||
- PRISM tags are now supported. | ||
## [1.0.2] - 2018-11-20 | ||
@@ -9,0 +15,0 @@ |
@@ -11,2 +11,3 @@ "use strict"; | ||
'bepress_citation_doi', | ||
'prism.doi', | ||
]; | ||
@@ -13,0 +14,0 @@ function parseDoi(identifier) { |
@@ -209,1 +209,28 @@ "use strict"; | ||
}); | ||
describe('Detecting DOIs located in prism.doi meta tags', function () { | ||
it('should not return identifiers that are not DOIs', function () { | ||
var dom = new jsdom_1.JSDOM("<!DOCTYPE html><html><head>\n <meta name=\"prism.doi\" content=\"https://osf.io/khbvy/\">\n </head><p>No DOIs here!</p></html>"); | ||
var document = dom.window.document; | ||
expect(index_1.getDois(document)).toEqual([]); | ||
}); | ||
it('should return a naked DOI', function () { | ||
var dom = new jsdom_1.JSDOM("<!DOCTYPE html><html><head>\n <meta name=\"prism.doi\" content=\"10.31219/osf.io/khbvy\">\n </head><p>Hello there</p></html>"); | ||
var document = dom.window.document; | ||
expect(index_1.getDois(document)).toEqual(['10.31219/osf.io/khbvy']); | ||
}); | ||
it('should return a DOI prefixed with `doi:`', function () { | ||
var dom = new jsdom_1.JSDOM("<!DOCTYPE html><html><head>\n <meta name=\"prism.doi\" content=\"doi:10.31219/osf.io/khbvy\">\n </head><p>Hello there</p></html>"); | ||
var document = dom.window.document; | ||
expect(index_1.getDois(document)).toEqual(['10.31219/osf.io/khbvy']); | ||
}); | ||
it('should return a DOI prefixed with `info:doi:`', function () { | ||
var dom = new jsdom_1.JSDOM("<!DOCTYPE html><html><head>\n <meta name=\"prism.doi\" content=\"info:doi:10.31219/osf.io/khbvy\">\n </head><p>Hello there</p></html>"); | ||
var document = dom.window.document; | ||
expect(index_1.getDois(document)).toEqual(['10.31219/osf.io/khbvy']); | ||
}); | ||
it('should return multiple DOIs when present', function () { | ||
var dom = new jsdom_1.JSDOM("<!DOCTYPE html><html><head>\n <meta name=\"prism.doi\" content=\"info:doi:10.31219/osf.io/khbvy\">\n <meta name=\"prism.doi\" content=\"10.1371/journal.pbio.1002456\">\n </head><p>Hello there</p></html>"); | ||
var document = dom.window.document; | ||
expect(index_1.getDois(document)).toEqual(['10.31219/osf.io/khbvy', '10.1371/journal.pbio.1002456']); | ||
}); | ||
}); |
@@ -438,1 +438,59 @@ import { JSDOM } from 'jsdom'; | ||
}); | ||
describe('Detecting DOIs located in prism.doi meta tags', () => { | ||
it('should not return identifiers that are not DOIs', () => { | ||
const dom = new JSDOM( | ||
`<!DOCTYPE html><html><head> | ||
<meta name="prism.doi" content="https://osf.io/khbvy/"> | ||
</head><p>No DOIs here!</p></html>` | ||
); | ||
const document = dom.window.document; | ||
expect(getDois(document)).toEqual([]); | ||
}); | ||
it('should return a naked DOI', () => { | ||
const dom = new JSDOM( | ||
`<!DOCTYPE html><html><head> | ||
<meta name="prism.doi" content="10.31219/osf.io/khbvy"> | ||
</head><p>Hello there</p></html>` | ||
); | ||
const document = dom.window.document; | ||
expect(getDois(document)).toEqual(['10.31219/osf.io/khbvy']); | ||
}); | ||
it('should return a DOI prefixed with `doi:`', () => { | ||
const dom = new JSDOM( | ||
`<!DOCTYPE html><html><head> | ||
<meta name="prism.doi" content="doi:10.31219/osf.io/khbvy"> | ||
</head><p>Hello there</p></html>` | ||
); | ||
const document = dom.window.document; | ||
expect(getDois(document)).toEqual(['10.31219/osf.io/khbvy']); | ||
}); | ||
it('should return a DOI prefixed with `info:doi:`', () => { | ||
const dom = new JSDOM( | ||
`<!DOCTYPE html><html><head> | ||
<meta name="prism.doi" content="info:doi:10.31219/osf.io/khbvy"> | ||
</head><p>Hello there</p></html>` | ||
); | ||
const document = dom.window.document; | ||
expect(getDois(document)).toEqual(['10.31219/osf.io/khbvy']); | ||
}); | ||
it('should return multiple DOIs when present', () => { | ||
const dom = new JSDOM( | ||
`<!DOCTYPE html><html><head> | ||
<meta name="prism.doi" content="info:doi:10.31219/osf.io/khbvy"> | ||
<meta name="prism.doi" content="10.1371/journal.pbio.1002456"> | ||
</head><p>Hello there</p></html>` | ||
); | ||
const document = dom.window.document; | ||
expect(getDois(document)).toEqual(['10.31219/osf.io/khbvy', '10.1371/journal.pbio.1002456']); | ||
}); | ||
}); |
@@ -10,2 +10,3 @@ import './polyfills'; | ||
'bepress_citation_doi', | ||
'prism.doi', | ||
]; | ||
@@ -12,0 +13,0 @@ |
{ | ||
"name": "get-dois", | ||
"version": "1.0.2", | ||
"version": "1.1.0-master-e05556eedaca8d2c7355c50db758af1286e3adca", | ||
"description": "Detect Digital Object Identifiers listed in the metadata of a DOM tree", | ||
@@ -34,2 +34,3 @@ "scripts": { | ||
"jest": "^23.6.0", | ||
"jest-junit": "^6.0.1", | ||
"jsdom": "^13.0.0", | ||
@@ -36,0 +37,0 @@ "ts-jest": "^23.10.4", |
@@ -44,2 +44,3 @@ get-dois | ||
- bepress tags (`bepress_citation_doi`) | ||
- PRISM tags (`prism.doi`) | ||
- Dublin Core Schema markup (`dc.identifier` and/or `dc.relation`) | ||
@@ -46,0 +47,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
206908
929
52
7
1