From 7940915bb09235f46846a41e12d079967bca9363 Mon Sep 17 00:00:00 2001 From: Tom Najdek Date: Thu, 4 Nov 2021 20:32:35 +0100 Subject: [PATCH] Fix arXiv ID not imported. Fix #2236. (#2238) Mendeley online schema uses "arxiv", local DB uses "arxivId" hence it was skipped. This commit adds mapping and a test. --- .../zotero/import/mendeley/mendeleyOnlineMappings.js | 1 + test/tests/data/mendeleyMock/items-simple.json | 6 ++++++ test/tests/mendeleyImport.js | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/chrome/content/zotero/import/mendeley/mendeleyOnlineMappings.js b/chrome/content/zotero/import/mendeley/mendeleyOnlineMappings.js index 7bfa71120f..102437f1fd 100644 --- a/chrome/content/zotero/import/mendeley/mendeleyOnlineMappings.js +++ b/chrome/content/zotero/import/mendeley/mendeleyOnlineMappings.js @@ -25,6 +25,7 @@ var mendeleyOnlineMappings = { working_paper: 'WorkingPaper' }, apiFieldToDBField: { + arxiv: 'arxivId', accessed: 'dateAccessed', authors: false, // all author types handled separately citation_key: 'citationKey', diff --git a/test/tests/data/mendeleyMock/items-simple.json b/test/tests/data/mendeleyMock/items-simple.json index b162350aca..79921d0def 100644 --- a/test/tests/data/mendeleyMock/items-simple.json +++ b/test/tests/data/mendeleyMock/items-simple.json @@ -11,6 +11,12 @@ "profile_id": "8dbf0832-8723-4c48-b532-20c0b7f6e01a", "read": false, "source": "lorem ipsum", + "identifiers": + { + "doi": "10.1111", + "pmid": "11111111", + "arxiv": "1111.2222" + }, "starred": false, "title": "Foo Bar", "type": "journal", diff --git a/test/tests/mendeleyImport.js b/test/tests/mendeleyImport.js index 6857733c62..6563899812 100644 --- a/test/tests/mendeleyImport.js +++ b/test/tests/mendeleyImport.js @@ -102,6 +102,11 @@ describe('Zotero_Import_Mendeley', function () { assert.equal(journal.itemTypeID, Zotero.ItemTypes.getID('journalArticle')); assert.equal(report.getField('title'), 'Sample Report'); assert.equal(report.itemTypeID, Zotero.ItemTypes.getID('report')); + + // test identifiers + assert.equal(journal.getField('DOI'), '10.1111'); + assert.include(journal.getField('extra'), 'PMID: 11111111'); + assert.include(journal.getField('extra'), 'arXiv: 1111.2222'); const parentCollection = await Zotero.Collections.getAsync( journal.getCollections().pop()