fix incident links with helper
This commit is contained in:
1 parent
618258d282
commit
7fb57d8090
20 files changed
+83
-34
No files matched your search
@@ -105,6 +105,14 @@ describe("MatrixProvider", () => {
|
||||
expect(body.formatted_body).toContain("View Incident");
|
||||
});
|
||||
|
||||
it("links the incident to the monitor's incidents page", async () => {
|
||||
const { provider } = createProvider();
|
||||
await provider.sendMessage(makeNotification() as any, makeMessageWithIncident());
|
||||
const body = mockGotPut.mock.calls[0][1].json;
|
||||
expect(body.body).toContain("View Incident: https://app.example.com/incidents/mon-1");
|
||||
expect(body.formatted_body).toContain('href="https://app.example.com/incidents/mon-1"');
|
||||
});
|
||||
|
||||
it("omits optional sections when not present", async () => {
|
||||
const { provider } = createProvider();
|
||||
const msg = makeMessage();
|
||||
|
||||
@@ -106,7 +106,7 @@ describe("NtfyProvider", () => {
|
||||
it("includes incident links in text", async () => {
|
||||
const { provider } = createProvider();
|
||||
await provider.sendMessage(makeNtfyNotification() as any, makeMessageWithIncident());
|
||||
expect(mockGotPost.mock.calls[0][1].body).toContain("/infrastructure/mon-1");
|
||||
expect(mockGotPost.mock.calls[0][1].body).toContain("https://app.example.com/incidents/mon-1");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -99,6 +99,12 @@ describe("PushoverProvider", () => {
|
||||
expect(mockGotPost.mock.calls[0][1].form.message).toContain("View Incident");
|
||||
});
|
||||
|
||||
it("links the incident to the monitor's incidents page", async () => {
|
||||
const { provider } = createProvider();
|
||||
await provider.sendMessage(makeNotification() as any, makeMessageWithIncident());
|
||||
expect(mockGotPost.mock.calls[0][1].form.message).toContain("View Incident: https://app.example.com/incidents/mon-1");
|
||||
});
|
||||
|
||||
it("omits optional sections when not present", async () => {
|
||||
const { provider } = createProvider();
|
||||
const msg = makeMessage();
|
||||
|
||||
@@ -134,6 +134,7 @@ describe("RocketChatProvider", () => {
|
||||
["ping", "https://app.example.com/uptime/mon-1"],
|
||||
["pagespeed", "https://app.example.com/pagespeed/mon-1"],
|
||||
["hardware", "https://app.example.com/infrastructure/mon-1"],
|
||||
["docker", "https://app.example.com/docker/host/mon-1"],
|
||||
])("links %s monitors to %s", async (type, expectedLink) => {
|
||||
const { provider } = createProvider();
|
||||
|
||||
|
||||
@@ -139,6 +139,12 @@ describe("SignalgridProvider", () => {
|
||||
expect(mockGotPost.mock.calls[0][1].form.body).toContain("View Incident");
|
||||
});
|
||||
|
||||
it("links the incident to the monitor's incidents page", async () => {
|
||||
const { provider } = createProvider();
|
||||
await provider.sendMessage(makeNotification() as any, makeMessageWithIncident());
|
||||
expect(mockGotPost.mock.calls[0][1].form.body).toContain("View Incident: https://app.example.com/incidents/mon-1");
|
||||
});
|
||||
|
||||
it("omits optional sections when not present", async () => {
|
||||
const { provider } = createProvider();
|
||||
const msg = makeMessage();
|
||||
|
||||
@@ -96,6 +96,14 @@ describe("SlackProvider", () => {
|
||||
expect(text).toContain("Additional Information");
|
||||
});
|
||||
|
||||
it("links the incident button to the monitor's incidents page", async () => {
|
||||
const { provider } = createProvider();
|
||||
await provider.sendMessage(makeNotification() as any, makeMessageWithIncident());
|
||||
const blocks = mockGotPost.mock.calls[0][1].json.blocks;
|
||||
const actions = blocks.find((b: any) => b.type === "actions");
|
||||
expect(actions.elements[0].url).toBe("https://app.example.com/incidents/mon-1");
|
||||
});
|
||||
|
||||
it("omits threshold, details, and incident sections when not present", async () => {
|
||||
const { provider } = createProvider();
|
||||
const msg = makeMessage();
|
||||
|
||||
@@ -154,7 +154,7 @@ describe("TeamsProvider", () => {
|
||||
expect(card.actions).toHaveLength(1);
|
||||
expect(card.actions[0].type).toBe("Action.OpenUrl");
|
||||
expect(card.actions[0].title).toBe("View Incident");
|
||||
expect(card.actions[0].url).toContain("/incidents/inc-1");
|
||||
expect(card.actions[0].url).toBe("https://app.example.com/incidents/mon-1");
|
||||
});
|
||||
|
||||
it("omits actions when no incident is present", async () => {
|
||||
|
||||
@@ -99,6 +99,12 @@ describe("TelegramProvider", () => {
|
||||
expect(mockGotPost.mock.calls[0][1].json.text).toContain("View Incident");
|
||||
});
|
||||
|
||||
it("links the incident to the monitor's incidents page", async () => {
|
||||
const { provider } = createProvider();
|
||||
await provider.sendMessage(makeNotification() as any, makeMessageWithIncident());
|
||||
expect(mockGotPost.mock.calls[0][1].json.text).toContain('<a href="https://app.example.com/incidents/mon-1">View Incident</a>');
|
||||
});
|
||||
|
||||
it("omits optional sections when not present", async () => {
|
||||
const { provider } = createProvider();
|
||||
const msg = makeMessage();
|
||||
|
||||
@@ -86,6 +86,12 @@ describe("WebhookProvider", () => {
|
||||
expect(mockGotPost.mock.calls[0][1].json.text).toContain("View Incident");
|
||||
});
|
||||
|
||||
it("links the incident to the monitor's incidents page", async () => {
|
||||
const { provider } = createProvider();
|
||||
await provider.sendMessage(makeNotification() as any, makeMessageWithIncident());
|
||||
expect(mockGotPost.mock.calls[0][1].json.text).toContain("[View Incident](https://app.example.com/incidents/mon-1)");
|
||||
});
|
||||
|
||||
it("omits threshold and incident sections when not present", async () => {
|
||||
const { provider } = createProvider();
|
||||
const msg = makeMessage();
|
||||
|
||||
Reference in new issue
Block a user