Remove "Error:" expected in error messages.

* "Error:" seems to have been injected into the message by Bluebird,
  but that's no longer the case
This commit is contained in:
Tom Najdek 2017-05-31 16:52:06 +01:00 committed by Dan Stillman
parent 063e13ef22
commit 4ec6925220
4 changed files with 18 additions and 18 deletions

View file

@ -128,12 +128,12 @@ describe("Zotero.FeedItem", function () {
it("should require feed being set", function* () {
let feedItem = new Zotero.FeedItem('book', { guid: Zotero.randomString() });
// Defaults to user library ID
yield assert.isRejected(feedItem.saveTx(), /^Error: Cannot add /);
yield assert.isRejected(feedItem.saveTx(), /^Cannot add /);
});
it("should require GUID being set", function* () {
let feedItem = new Zotero.FeedItem('book');
feedItem.libraryID = feed.libraryID;
yield assert.isRejected(feedItem.saveTx(), /^Error: GUID must be set before saving FeedItem$/);
yield assert.isRejected(feedItem.saveTx(), /^GUID must be set before saving FeedItem$/);
});
it("should require a unique GUID", function* () {
let guid = Zotero.randomString();
@ -149,7 +149,7 @@ describe("Zotero.FeedItem", function () {
it("should require item type being set", function* () {
let feedItem = new Zotero.FeedItem(null, { guid: Zotero.randomString() });
feedItem.libraryID = feed.libraryID;
yield assert.isRejected(feedItem.saveTx(), /^Error: Item type must be set before saving$/);
yield assert.isRejected(feedItem.saveTx(), /^Item type must be set before saving$/);
});
it("should save feed item", function* () {
let guid = Zotero.randomString();

View file

@ -12,7 +12,7 @@ describe("Zotero.Feed", function() {
describe("#constructor()", function() {
it("should accept required fields as arguments", function* () {
let feed = new Zotero.Feed();
yield assert.isRejected(feed.saveTx(), /^Error: Feed name not set$/);
yield assert.isRejected(feed.saveTx(), /^Feed name not set$/);
feed = new Zotero.Feed({
name: 'Test ' + Zotero.randomString(),
@ -93,28 +93,28 @@ describe("Zotero.Feed", function() {
});
it("should throw if name or url are missing", function *() {
let feed = new Zotero.Feed();
yield assert.isRejected(feed.saveTx(), /^Error: Feed name not set$/);
yield assert.isRejected(feed.saveTx(), /^Feed name not set$/);
feed.name = 'Test ' + Zotero.randomString();
yield assert.isRejected(feed.saveTx(), /^Error: Feed URL not set$/);
yield assert.isRejected(feed.saveTx(), /^Feed URL not set$/);
feed = new Zotero.Feed();
feed.url = 'http://' + Zotero.randomString() + '.com';
yield assert.isRejected(feed.saveTx(), /^Error: Feed name not set$/);
yield assert.isRejected(feed.saveTx(), /^Feed name not set$/);
});
it("should not allow saving a feed with the same url", function *() {
let url = 'http://' + Zotero.randomString() + '.com';
let feed1 = yield createFeed({ url });
let feed2 = new Zotero.Feed({ name: 'Test ' + Zotero.randomString(), url });
yield assert.isRejected(feed2.saveTx(), /^Error: Feed for URL already exists: /);
yield assert.isRejected(feed2.saveTx(), /^Feed for URL already exists: /);
// Perform check with normalized URL
feed2.url = url + '/';
yield assert.isRejected(feed2.saveTx(), /^Error: Feed for URL already exists: /);
yield assert.isRejected(feed2.saveTx(), /^Feed for URL already exists: /);
feed2.url = url.toUpperCase();
yield assert.isRejected(feed2.saveTx(), /^Error: Feed for URL already exists: /);
yield assert.isRejected(feed2.saveTx(), /^Feed for URL already exists: /);
});
it("should allow saving a feed with the same name", function *() {
let name = 'Test ' + Zotero.randomString();
@ -405,11 +405,11 @@ describe("Zotero.Feed", function() {
})
it("should not allow adding collections", function* () {
let collection = new Zotero.Collection({ name: 'test', libraryID: feed.libraryID });
yield assert.isRejected(collection.saveTx({ skipEditCheck: true }), /^Error: Cannot add /);
yield assert.isRejected(collection.saveTx({ skipEditCheck: true }), /^Cannot add /);
});
it("should not allow adding saved search", function* () {
let search = new Zotero.Search({ name: 'test', libraryID: feed.libraryID });
yield assert.isRejected(search.saveTx({ skipEditCheck: true }), /^Error: Cannot add /);
yield assert.isRejected(search.saveTx({ skipEditCheck: true }), /^Cannot add /);
});
it("should allow adding feed item", function* () {
let feedItem = new Zotero.FeedItem('book', { guid: Zotero.randomString() });

View file

@ -146,7 +146,7 @@ describe("Zotero.Libraries", function() {
assert.equal(Zotero.Libraries.isEditable(group.libraryID), startState, 'reverts state');
});
it("should throw for invalid library ID", function() {
return assert.isRejected(Zotero.Libraries.setEditable(-1), /^Error: Invalid library ID /);
return assert.isRejected(Zotero.Libraries.setEditable(-1), /^Invalid library ID /);
});
});
describe("#isFilesEditable()", function() {
@ -176,7 +176,7 @@ describe("Zotero.Libraries", function() {
yield Zotero.Libraries.setEditable(group.libraryID, editableStartState);
});
it("should throw for invalid library ID", function* () {
return assert.isRejected(Zotero.Libraries.setFilesEditable(-1), /^Error: Invalid library ID /);
return assert.isRejected(Zotero.Libraries.setFilesEditable(-1), /^Invalid library ID /);
});
});
describe("#isGroupLibrary()", function() {

View file

@ -157,7 +157,7 @@ describe("Zotero.Library", function() {
describe("#save()", function() {
it("should require mandatory parameters to be set", function* () {
let library = new Zotero.Library({ editable: true, filesEditable: true });
yield assert.isRejected(library.saveTx(), /^Error: libraryType must be set before saving/, 'libraryType is mandatory');
yield assert.isRejected(library.saveTx(), /^libraryType must be set before saving/, 'libraryType is mandatory');
// Required group params
let groupID = Zotero.Utilities.rand(1000, 10000);
@ -165,10 +165,10 @@ describe("Zotero.Library", function() {
let description = '';
let version = Zotero.Utilities.rand(1000, 10000);
library = new Zotero.Group({ filesEditable: true, groupID, name , description, version });
yield assert.isRejected(library.saveTx(), /^Error: editable must be set before saving/, 'editable is mandatory');
yield assert.isRejected(library.saveTx(), /^editable must be set before saving/, 'editable is mandatory');
library = new Zotero.Group({ editable: true, groupID, name , description, version });
yield assert.isRejected(library.saveTx(), /^Error: filesEditable must be set before saving/, 'filesEditable is mandatory');
yield assert.isRejected(library.saveTx(), /^filesEditable must be set before saving/, 'filesEditable is mandatory');
library = new Zotero.Group({ editable: true, filesEditable: true, groupID, name , description, version });
yield assert.isFulfilled(library.saveTx());
@ -217,7 +217,7 @@ 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");
yield assert.isRejected(library.eraseTx(), /^Cannot erase library of type 'user'$/, "does not allow erasing user library");
});
it("should not allow erasing unsaved libraries", function* () {