Make test more independent of db state

If there are library ids above 9 string sorting may not put the
highest id last in the array.
This commit is contained in:
Sylvester Keil 2018-08-03 11:53:54 +02:00
parent 07464d5c84
commit aa94a62a74
No known key found for this signature in database
GPG key ID: 878933BCEAB25A10

View file

@ -62,7 +62,7 @@ describe("Zotero.Libraries", function() {
});
it("should return false for a non-existing ID", function() {
assert.isFalse(Zotero.Libraries.exists(-1), "returns boolean false for a negative ID");
let badID = Zotero.Libraries.getAll().map(library => library.libraryID).sort().pop() + 1;
let badID = Zotero.Libraries.getAll().map(lib => lib.libraryID).reduce((a, b) => (a < b ? b : a)) + 1;
assert.isFalse(Zotero.Libraries.exists(badID), "returns boolean false for a non-existent positive ID");
});
});