Fix test for invalid id passed to DataObjects.getAsync()
This commit is contained in:
parent
33deefbf74
commit
2237c71dcb
2 changed files with 10 additions and 2 deletions
|
@ -177,8 +177,8 @@ Zotero.DataObjects.prototype.getAsync = Zotero.Promise.coroutine(function* (ids,
|
|||
toReturn.push(this._objectCache[id]);
|
||||
}
|
||||
else {
|
||||
if (!ids.every(id => Number.isInteger(id))) {
|
||||
throw new Error(`Invalid ${this._ZDO_object} ID '${id}'`);
|
||||
if (!Number.isInteger(id)) {
|
||||
throw new Error(`Invalid ${this._ZDO_object} ID '${id}' (${typeof id})`);
|
||||
}
|
||||
toLoad.push(id);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,14 @@ describe("Zotero.DataObjects", function () {
|
|||
});
|
||||
});
|
||||
|
||||
describe("#getAsync()", function () {
|
||||
it("show throw if passed an invalid id", function* () {
|
||||
var e = yield getPromiseError(Zotero.Items.getAsync("[Object]"));
|
||||
assert.ok(e);
|
||||
assert.include(e.message, '(string)');
|
||||
});
|
||||
});
|
||||
|
||||
describe("#getLibraryAndKeyFromID()", function () {
|
||||
it("should return a libraryID and key within a transaction", function* () {
|
||||
for (let type of types) {
|
||||
|
|
Loading…
Reference in a new issue