Adjust connector server test for ece3491e2

This commit is contained in:
Adomas Venčkauskas 2017-07-19 11:55:41 +03:00
parent ece3491e21
commit 84c1367e7b

View File

@ -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({ var group = yield createGroup({
editable: false editable: false
}); });
@ -191,7 +191,6 @@ describe("Connector Server", function () {
uri: "http://example.com" uri: "http://example.com"
}; };
var promise = waitForItemEvent('add');
var req = yield Zotero.HTTP.request( var req = yield Zotero.HTTP.request(
'POST', 'POST',
connectorServerPath + "/connector/saveItems", connectorServerPath + "/connector/saveItems",
@ -199,21 +198,17 @@ describe("Connector Server", function () {
headers: { headers: {
"Content-Type": "application/json" "Content-Type": "application/json"
}, },
body: JSON.stringify(body) body: JSON.stringify(body),
successCodes: false
} }
); );
// Check item assert.equal(req.status, 500);
var ids = yield promise; assert.isFalse(JSON.parse(req.responseText).libraryEditable);
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);
// My Library should've been selected // The selection should remain
assert.equal( assert.equal(
win.ZoteroPane.collectionsView.getSelectedLibraryID(), Zotero.Libraries.userLibraryID win.ZoteroPane.collectionsView.getSelectedLibraryID(), group.libraryID
); );
}); });