mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Fix calendar test
This commit is contained in:
parent
4c8508b0a9
commit
bdfd6e5e9f
@ -126,6 +126,8 @@ NodeHelper.checkFetchError = function (error) {
|
||||
let error_type = "MODULE_ERROR_UNSPECIFIED";
|
||||
if (error.code === "EAI_AGAIN") {
|
||||
error_type = "MODULE_ERROR_NO_CONNECTION";
|
||||
} else if (error.message === "Unauthorized") {
|
||||
error_type = "MODULE_ERROR_UNAUTHORIZED";
|
||||
}
|
||||
return error_type;
|
||||
};
|
||||
|
@ -147,7 +147,8 @@ Module.register("calendar", {
|
||||
}
|
||||
}
|
||||
} else if (notification === "CALENDAR_ERROR") {
|
||||
this.error = this.translate("MODULE_CONFIG_ERROR", { MODULE_NAME: this.name, ERROR: payload.error });
|
||||
let error_message = this.translate(payload.error_type);
|
||||
this.error = this.translate("MODULE_CONFIG_ERROR", { MODULE_NAME: this.name, ERROR: error_message });
|
||||
this.loaded = true;
|
||||
}
|
||||
|
||||
|
@ -58,6 +58,7 @@ module.exports = NodeHelper.create({
|
||||
Log.error("Calendar Error. Could not fetch calendar: ", fetcher.url(), error);
|
||||
let error_type = NodeHelper.checkFetchError(error);
|
||||
this.sendSocketNotification("CALENDAR_ERROR", {
|
||||
id: identifier,
|
||||
error_type
|
||||
});
|
||||
});
|
||||
|
@ -150,7 +150,7 @@ describe("Calendar module", function () {
|
||||
});
|
||||
|
||||
it("should show Unauthorized error", function () {
|
||||
return app.client.waitUntilTextExists(".calendar", "Error in the calendar module. Unauthorized", 10000);
|
||||
return app.client.waitUntilTextExists(".calendar", "Error in the calendar module. Authorization failed", 10000);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -32,6 +32,7 @@
|
||||
"MODULE_CONFIG_ERROR": "Error in the {MODULE_NAME} module. {ERROR}",
|
||||
"MODULE_ERROR_MALFORMED_URL": "Malformed url.",
|
||||
"MODULE_ERROR_NO_CONNECTION": "No internet connection.",
|
||||
"MODULE_ERROR_UNAUTHORIZED": "Authorization failed.",
|
||||
"MODULE_ERROR_UNSPECIFIED": "Check logs for more details.",
|
||||
|
||||
"UPDATE_NOTIFICATION": "MagicMirror² update available.",
|
||||
|
Loading…
x
Reference in New Issue
Block a user