Comparing version 3.0.0-master-274460418-bb20630b to 3.0.0-master-373189176-bfa9e24d
@@ -7,2 +7,6 @@ # Changelog | ||
### New features | ||
- DC.identifier.DOI tags are now supported. In concrete terms, this should mean that more items on Figshare should now be recognised. | ||
## [3.0.0] - 2019-08-17 | ||
@@ -9,0 +13,0 @@ |
@@ -11,2 +11,3 @@ "use strict"; | ||
'prism.doi', | ||
'dc.identifier.doi', | ||
]; | ||
@@ -13,0 +14,0 @@ function parseDoi(identifier) { |
@@ -209,2 +209,31 @@ "use strict"; | ||
}); | ||
// DC.identifier.DOI is used by some Figshare pages. See | ||
// https://gitlab.com/Flockademic/get-dois/issues/7 | ||
describe('Detecting DOIs located in DC.identfier.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=\"DC.identifier.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=\"DC.identifier.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=\"DC.identifier.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=\"DC.identifier.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=\"DC.identifier.DOI\" content=\"info:doi:10.31219/osf.io/khbvy\">\n <meta name=\"DC.identifier.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']); | ||
}); | ||
}); | ||
describe('Detecting DOIs located in meta tags identified by the `property` attribute', function () { | ||
@@ -211,0 +240,0 @@ it('should not return identifiers that are not DOIs', function () { |
@@ -439,2 +439,62 @@ import { JSDOM } from 'jsdom'; | ||
// DC.identifier.DOI is used by some Figshare pages. See | ||
// https://gitlab.com/Flockademic/get-dois/issues/7 | ||
describe('Detecting DOIs located in DC.identfier.DOI meta tags', () => { | ||
it('should not return identifiers that are not DOIs', () => { | ||
const dom = new JSDOM( | ||
`<!DOCTYPE html><html><head> | ||
<meta name="DC.identifier.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="DC.identifier.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="DC.identifier.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="DC.identifier.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="DC.identifier.DOI" content="info:doi:10.31219/osf.io/khbvy"> | ||
<meta name="DC.identifier.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']); | ||
}); | ||
}); | ||
describe('Detecting DOIs located in meta tags identified by the `property` attribute', () => { | ||
@@ -441,0 +501,0 @@ it('should not return identifiers that are not DOIs', () => { |
@@ -10,2 +10,3 @@ import './polyfills'; | ||
'prism.doi', | ||
'dc.identifier.doi', | ||
]; | ||
@@ -12,0 +13,0 @@ |
{ | ||
"name": "get-dois", | ||
"version": "3.0.0-master-274460418-bb20630b", | ||
"version": "3.0.0-master-373189176-bfa9e24d", | ||
"description": "Detect Digital Object Identifiers listed in the metadata of a DOM tree", | ||
@@ -5,0 +5,0 @@ "scripts": { |
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
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
62485
1059