Fix search error on nonexistent collection in recursive mode

And don't return results for a nonexistent parent search
This commit is contained in:
Dan Stillman 2018-11-28 15:19:19 -07:00
parent 6137aeddb8
commit 223f582aa7
2 changed files with 37 additions and 13 deletions

View file

@ -193,6 +193,18 @@ describe("Zotero.Search", function() {
var matches = yield s.search();
assert.sameMembers(matches, [item.id]);
});
it("should return no results for a collection that doesn't exist in recursive mode", async function () {
var item = await createDataObject('item');
var s = new Zotero.Search();
s.libraryID = item.libraryID;
s.name = "Test";
s.addCondition('collection', 'is', Zotero.DataObjectUtilities.generateKey());
s.addCondition('recursive', 'true');
var matches = await s.search();
assert.lengthOf(matches, 0);
});
});
describe("fileTypeID", function () {
@ -361,6 +373,17 @@ describe("Zotero.Search", function() {
var matches = yield s.search();
assert.notInclude(matches, item.id);
});
it("should return no results for a search that doesn't exist", async function () {
var item = await createDataObject('item');
var s = new Zotero.Search();
s.libraryID = item.libraryID;
s.name = "Test";
s.addCondition('savedSearch', 'is', Zotero.DataObjectUtilities.generateKey());
var matches = await s.search();
assert.lengthOf(matches, 0);
});
});
describe("unfiled", function () {