diff --git a/server/notification-providers/dingding.js b/server/notification-providers/dingding.js index ea5a258..db52b0a 100644 --- a/server/notification-providers/dingding.js +++ b/server/notification-providers/dingding.js @@ -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)) { diff --git a/server/notification-providers/dingding.spec.js b/server/notification-providers/dingding.spec.js index 6868385..b6307ac 100644 --- a/server/notification-providers/dingding.spec.js +++ b/server/notification-providers/dingding.spec.js @@ -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", },