Add cleanDOI() tests
In advance of #1356 We're not properly handling DOIs in parentheses or brackets (which would require non-regex logic), so those tests are skipped for now.
This commit is contained in:
parent
24507a73f6
commit
01c71fd970
|
@ -32,7 +32,33 @@ describe("Zotero.Utilities", function() {
|
|||
assert.equal(author.lastName, 'Žolynas');
|
||||
})
|
||||
});
|
||||
describe("cleanISBN", function() {
|
||||
|
||||
|
||||
describe("#cleanDOI()", function () {
|
||||
var cleanDOI = Zotero.Utilities.cleanDOI;
|
||||
var doi = '10.1088/1748-9326/11/4/048002';
|
||||
|
||||
it("should parse a DOI", function () {
|
||||
assert.equal(cleanDOI(`${doi}`), doi);
|
||||
});
|
||||
|
||||
it("should parse a DOI at the end of a sentence", function () {
|
||||
assert.equal(cleanDOI(`Foo bar ${doi}. Foo bar`), doi);
|
||||
});
|
||||
|
||||
// FIXME
|
||||
it.skip("should parse a DOI in parentheses", function () {
|
||||
assert.equal(cleanDOI(`Foo bar (${doi}) foo bar`), doi);
|
||||
});
|
||||
|
||||
// FIXME
|
||||
it.skip("should parse a DOI in brackets", function () {
|
||||
assert.equal(cleanDOI(`Foo bar [${doi}] foo bar`), doi);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("#cleanISBN()", function() {
|
||||
let cleanISBN = Zotero.Utilities.cleanISBN;
|
||||
it("should return false for non-ISBN string", function() {
|
||||
assert.isFalse(cleanISBN(''), 'returned false for empty string');
|
||||
|
|
Loading…
Reference in New Issue
Block a user