Check Extra field for DOIs for PDF retrieval
E.g., a book with a DOI in Extra Closes #1551
This commit is contained in:
parent
944188fa63
commit
05d8e7a8a3
6 changed files with 127 additions and 2 deletions
|
@ -113,6 +113,34 @@ describe("Zotero.Utilities.Internal", function () {
|
|||
});
|
||||
|
||||
|
||||
describe("#extractExtraFields()", function () {
|
||||
it("should extract a field", function () {
|
||||
var val = '10.1234/abcdef';
|
||||
var str = `DOI: ${val}`;
|
||||
var fields = Zotero.Utilities.Internal.extractExtraFields(str);
|
||||
assert.equal(fields.size, 1);
|
||||
assert.equal(fields.get('DOI').value, val);
|
||||
});
|
||||
|
||||
it("should extract a field with different case", function () {
|
||||
var val = '10.1234/abcdef';
|
||||
var str = `doi: ${val}`;
|
||||
var fields = Zotero.Utilities.Internal.extractExtraFields(str);
|
||||
assert.equal(fields.size, 1);
|
||||
assert.equal(fields.get('DOI').value, val);
|
||||
});
|
||||
|
||||
it("should extract a field with other fields, text, and whitespace", function () {
|
||||
var originalDateVal = '1989';
|
||||
var doiVal = '10.1234/abcdef';
|
||||
var str = `\nOriginal Date: ${originalDateVal}\nDOI: ${doiVal}\n\n`;
|
||||
var fields = Zotero.Utilities.Internal.extractExtraFields(str);
|
||||
assert.equal(fields.size, 1);
|
||||
assert.equal(fields.get('DOI').value, doiVal);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("#extractIdentifiers()", function () {
|
||||
it("should extract ISBN-10", async function () {
|
||||
var id = "0838985890";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue