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({
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
);
});