Use UnexpectedStatusException in Zotero.HTTP.loadDocuments()

Follow-up to 76ae5d9f59, which changed loadDocuments() to pass/throw an
Error on a non-2xx response code
This commit is contained in:
Dan Stillman 2020-10-24 00:00:50 -04:00
parent 76ae5d9f59
commit 29f48476a9
2 changed files with 24 additions and 3 deletions

View file

@ -302,5 +302,17 @@ describe("Zotero.HTTP", function () {
});
assert.isTrue(called);
});
it("should fail on non-2xx response", async function () {
var e = await getPromiseError(new Zotero.Promise((resolve, reject) => {
Zotero.HTTP.loadDocuments(
baseURL + "nonexistent",
() => {},
resolve,
reject
);
}));
assert.instanceOf(e, Zotero.HTTP.UnexpectedStatusException);
});
});
});