From 84c1367e7b93c629438c73f2c950b08390cfd76f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Wed, 19 Jul 2017 11:55:41 +0300 Subject: [PATCH] Adjust connector server test for ece3491e2 --- test/tests/server_connectorTest.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/test/tests/server_connectorTest.js b/test/tests/server_connectorTest.js index f469129364..4dc2dd0db4 100644 --- a/test/tests/server_connectorTest.js +++ b/test/tests/server_connectorTest.js @@ -166,7 +166,7 @@ describe("Connector Server", function () { }); - it("should save to My Library if read-only library is selected", function* () { + it("should respond with 500 if read-only library is selected", function* () { var group = yield createGroup({ editable: false }); @@ -191,7 +191,6 @@ describe("Connector Server", function () { uri: "http://example.com" }; - var promise = waitForItemEvent('add'); var req = yield Zotero.HTTP.request( 'POST', connectorServerPath + "/connector/saveItems", @@ -199,21 +198,17 @@ describe("Connector Server", function () { headers: { "Content-Type": "application/json" }, - body: JSON.stringify(body) + body: JSON.stringify(body), + successCodes: false } ); - // Check item - var ids = yield promise; - assert.lengthOf(ids, 1); - var item = Zotero.Items.get(ids[0]); - assert.equal(Zotero.ItemTypes.getName(item.itemTypeID), 'newspaperArticle'); - // Item should've been saved to My Library - assert.equal(item.libraryID, Zotero.Libraries.userLibraryID); + assert.equal(req.status, 500); + assert.isFalse(JSON.parse(req.responseText).libraryEditable); - // My Library should've been selected + // The selection should remain assert.equal( - win.ZoteroPane.collectionsView.getSelectedLibraryID(), Zotero.Libraries.userLibraryID + win.ZoteroPane.collectionsView.getSelectedLibraryID(), group.libraryID ); });