fix #859 and update tests to match

This commit is contained in:
Jeffrey Koehler 2021-11-03 01:12:19 -05:00
parent 76eea7bdfd
commit 782c943f93
2 changed files with 4 additions and 4 deletions

View file

@ -14,7 +14,7 @@ class DingDing extends NotificationProvider {
msgtype: "markdown",
markdown: {
title: monitorJSON["name"],
text: `## [${this.statusToString(heartbeatJSON["status"])}] \n > ${heartbeatJSON["msg"]} \n > Time(UTC):${heartbeatJSON["time"]}`,
text: `## [${this.statusToString(heartbeatJSON["status"])}] ${monitorJSON["name"]}\n > ${heartbeatJSON["msg"]} \n > Time(UTC):${heartbeatJSON["time"]}`,
}
};
if (await this.sendToDingDing(notification, params)) {

View file

@ -53,7 +53,7 @@ describe("notification to act properly on send", () => {
let res = await notif.send(notificationConf, msg, monitorConf, heartbeatConf);
expect(axios).toHaveBeenCalledWith({
data: "{\"msgtype\":\"markdown\",\"markdown\":{\"title\":\"testing\",\"text\":\"## [UP] \\n > some message \\n > Time(UTC):example time\"}}",
data: "{\"msgtype\":\"markdown\",\"markdown\":{\"title\":\"testing\",\"text\":\"## [UP] testing\\n > some message \\n > Time(UTC):example time\"}}",
headers: {
"Content-Type": "application/json",
},
@ -146,7 +146,7 @@ describe("notification to act properly on error", () => {
}
expect(axios).toHaveBeenCalledWith({
data: "{\"msgtype\":\"markdown\",\"markdown\":{\"title\":\"testing\",\"text\":\"## [UP] \\n > some message \\n > Time(UTC):example time\"}}",
data: "{\"msgtype\":\"markdown\",\"markdown\":{\"title\":\"testing\",\"text\":\"## [UP] testing\\n > some message \\n > Time(UTC):example time\"}}",
headers: {
"Content-Type": "application/json",
},
@ -194,7 +194,7 @@ describe("notification to get proper data from Notification.send", () => {
expect(res).toBe("Sent Successfully.");
expect(axios).toHaveBeenCalledWith({
data: "{\"msgtype\":\"markdown\",\"markdown\":{\"title\":\"testing\",\"text\":\"## [UP] \\n > some message \\n > Time(UTC):example time\"}}",
data: "{\"msgtype\":\"markdown\",\"markdown\":{\"title\":\"testing\",\"text\":\"## [UP] testing\\n > some message \\n > Time(UTC):example time\"}}",
headers: {
"Content-Type": "application/json",
},