feat(notifications): enrich Rocket.Chat tests

This commit is contained in:
Marcos Paulo Diniz committed 2026-08-07 14:55:05 -03:00
1 parent 4b921f4986
commit ee25c6b479
2 files changed
+47 -3

No files matched your search

@@ -25,7 +25,7 @@ testNotificationProviderContract("RocketChatProvider", {
describe("RocketChatProvider", () => {
beforeEach(() => mockGotPost.mockReset().mockResolvedValue({}));
it("sends a text-only test alert", async () => {
it("sends a rich test alert without webhook overrides", async () => {
const { provider } = createProvider();
const result = await provider.sendTestAlert(makeNotification({ type: "rocket_chat" }));
@@ -34,11 +34,29 @@ describe("RocketChatProvider", () => {
expect(mockGotPost).toHaveBeenCalledWith(
"https://hooks.example.com/webhook",
expect.objectContaining({
json: { text: "This is a test notification from Checkmate" },
json: {
text: "This is a test notification from Checkmate",
attachments: [
{
color: "#0000FF",
title: "Checkmate test notification",
fields: [
{ title: "Channel", value: "Rocket.Chat", short: true },
{ title: "Status", value: "Test notification", short: true },
],
},
],
},
timeout: { request: 30000 },
retry: { limit: 0 },
})
);
const payload = mockGotPost.mock.calls[0][1].json;
expect(payload).not.toHaveProperty("alias");
expect(payload).not.toHaveProperty("avatar");
expect(payload).not.toHaveProperty("emoji");
expect(payload).not.toHaveProperty("channel");
});
it("returns false when the test webhook URL is missing", async () => {