Change the Server tests to be compatible with electron server
This commit is contained in:
parent
29fe62e0a7
commit
57fd05c7e3
2 changed files with 6 additions and 6 deletions
|
@ -43,7 +43,7 @@ Zotero.Server = new function() {
|
|||
/**
|
||||
* initializes a very rudimentary web server
|
||||
*/
|
||||
this.init = function(port, bindAllAddr, maxConcurrentConnections) {
|
||||
this.init = async function(port, bindAllAddr, maxConcurrentConnections) {
|
||||
if (Zotero.HTTP.browserIsOffline()) {
|
||||
Zotero.debug('Browser is offline -- not initializing HTTP server');
|
||||
_registerOnlineObserver();
|
||||
|
|
|
@ -4,9 +4,9 @@ describe("Zotero.Server", function () {
|
|||
Components.utils.import("resource://zotero-unit/httpd.js");
|
||||
var serverPath;
|
||||
|
||||
before(function* () {
|
||||
before(async function () {
|
||||
Zotero.Prefs.set("httpServer.enabled", true);
|
||||
Zotero.Server.init();
|
||||
await Zotero.Server.init();
|
||||
serverPath = 'http://127.0.0.1:' + Zotero.Prefs.get('httpServer.port');
|
||||
});
|
||||
|
||||
|
@ -25,7 +25,7 @@ describe("Zotero.Server", function () {
|
|||
init: function (options) {
|
||||
called = true;
|
||||
assert.isObject(options);
|
||||
assert.propertyVal(options.headers, "Accept-Charset", "UTF-8");
|
||||
assert.equal(options.headers["Accept-Charset"], "UTF-8");
|
||||
return 204;
|
||||
}
|
||||
};
|
||||
|
@ -77,7 +77,7 @@ describe("Zotero.Server", function () {
|
|||
|
||||
assert.ok(called);
|
||||
assert.equal(req.status, 201);
|
||||
assert.equal(req.getResponseHeader("Content-Type"), "text/plain");
|
||||
assert.include(req.getResponseHeader("Content-Type"), "text/plain");
|
||||
assert.equal(req.responseText, "Test");
|
||||
});
|
||||
|
||||
|
@ -137,7 +137,7 @@ describe("Zotero.Server", function () {
|
|||
|
||||
assert.ok(called);
|
||||
assert.equal(req.status, 201);
|
||||
assert.equal(req.getResponseHeader("Content-Type"), "text/plain");
|
||||
assert.include(req.getResponseHeader("Content-Type"), "text/plain");
|
||||
assert.equal(req.responseText, "Test");
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue