commit 84c1367e7b93c629438c73f2c950b08390cfd76f
parent ece3491e2114807364d3270467db06c0a5665eb5
Author: Adomas VenĨkauskas <adomas.ven@gmail.com>
Date: Wed, 19 Jul 2017 11:55:41 +0300
Adjust connector server test for ece3491e2
Diffstat:
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git 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
);
});