Fix test breakage after 5ff2a59f87

And remove all instances of `publicationsLibraryID`
This commit is contained in:
Dan Stillman 2017-04-13 00:13:27 -04:00
parent 5ff2a59f87
commit 6d18b46165
8 changed files with 41 additions and 142 deletions

View file

@ -92,12 +92,9 @@ describe("Zotero.Library", function() {
assert.equal((yield Zotero.DB.valueQueryAsync("SELECT filesEditable FROM libraries WHERE libraryID=?", library.libraryID)), 0)
});
it("should not be settable for user and publications libraries", function* () {
it("should not be settable for user libraries", function* () {
let library = Zotero.Libraries.get(Zotero.Libraries.userLibraryID);
assert.throws(function() {library.editable = false}, /^Cannot change _libraryEditable for user library$/, "does not allow setting user library as not editable");
library = Zotero.Libraries.get(Zotero.Libraries.publicationsLibraryID);
assert.throws(function() {library.editable = false}, /^Cannot change _libraryEditable for publications library$/, "does not allow setting publications library as not editable");
});
});
@ -106,10 +103,6 @@ describe("Zotero.Library", function() {
assert.isTrue(Zotero.Libraries.userLibrary.filesEditable);
});
it("should always return true for publications library", function() {
assert.isTrue(Zotero.Libraries.get(Zotero.Libraries.publicationsLibraryID).filesEditable);
});
it("should return files editable status", function() {
let library = Zotero.Libraries.get(Zotero.Libraries.userLibraryID);
assert.isTrue(library.filesEditable, 'user library is files editable');
@ -127,12 +120,9 @@ describe("Zotero.Library", function() {
assert.isFalse(Zotero.Libraries.isFilesEditable(library.libraryID), "sets files editable in cache to false");
});
it("should not be settable for user and publications libraries", function* () {
it("should not be settable for user libraries", function* () {
let library = Zotero.Libraries.get(Zotero.Libraries.userLibraryID);
assert.throws(function() {library.filesEditable = false}, /^Cannot change _libraryFilesEditable for user library$/, "does not allow setting user library as not files editable");
library = Zotero.Libraries.get(Zotero.Libraries.publicationsLibraryID);
assert.throws(function() {library.filesEditable = false}, /^Cannot change _libraryFilesEditable for publications library$/, "does not allow setting publications library as not files editable");
});
});
@ -153,12 +143,9 @@ describe("Zotero.Library", function() {
assert.equal((yield Zotero.DB.valueQueryAsync("SELECT archived FROM libraries WHERE libraryID=?", library.libraryID)), 0)
});
it("should not be settable for user and publications libraries", function* () {
it("should not be settable for user libraries", function* () {
let library = Zotero.Libraries.get(Zotero.Libraries.userLibraryID);
assert.throws(() => library.archived = true, /^Cannot change _libraryArchived for user library$/, "does not allow setting user library as archived");
library = Zotero.Libraries.get(Zotero.Libraries.publicationsLibraryID);
assert.throws(() => library.archived = true, /^Cannot change _libraryArchived for publications library$/, "does not allow setting publications library as archived");
});
it("should only be settable on read-only library", function* () {
@ -231,9 +218,6 @@ describe("Zotero.Library", function() {
it("should not allow erasing permanent libraries", function* () {
let library = Zotero.Libraries.get(Zotero.Libraries.userLibraryID);
yield assert.isRejected(library.eraseTx(), /^Error: Cannot erase library of type 'user'$/, "does not allow erasing user library");
library = Zotero.Libraries.get(Zotero.Libraries.publicationsLibraryID);
yield assert.isRejected(library.eraseTx(), /^Error: Cannot erase library of type 'publications'$/, "does not allow erasing publications library");
});
it("should not allow erasing unsaved libraries", function* () {