Allow number or name for translator type in buildDummyTranslator()

This reverts c6b78da69d, which changed it to expect numbers when I
noticed the type being undefined in debug output, but apparently the
only tests where the type actually mattered passed it as a name.

At some point we should just change all tests to pass as a name.
This commit is contained in:
Dan Stillman 2017-01-23 08:58:16 -05:00
parent edb08e179c
commit a43f9d16ac

View file

@ -776,10 +776,10 @@ var generateTranslatorExportData = Zotero.Promise.coroutine(function* generateTr
* Build a dummy translator that can be passed to Zotero.Translate
*/
function buildDummyTranslator(translatorType, code, info={}) {
const TRANSLATOR_TYPES = {1: "import", 2: "export", 4: "web", 8: "search"};
const TRANSLATOR_TYPES = {"import":1, "export":2, "web":4, "search":8};
info = Object.assign({
"translatorID":"dummy-translator",
"translatorType":TRANSLATOR_TYPES[translatorType],
"translatorType": Number.isInteger(translatorType) ? translatorType : TRANSLATOR_TYPES[translatorType],
"label":"Dummy Translator",
"creator":"Simon Kornblith",
"target":"",