mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-20 17:13:49 +00:00
fix: link only the repo head in message titles, keep the subject plain
This commit is contained in:
7 files changed
+75
-15
No files matched your search
@@ -309,7 +309,8 @@ describe("dispatchEvent fallback routing", () => {
|
||||
const logBody = JSON.parse(sent[1]!.body) as {
|
||||
embeds?: Array<{ title?: string; color?: number; fields?: Array<{ value: string }> }>;
|
||||
};
|
||||
expect(logBody.embeds?.[0]?.title).toBe("owner/repo: push");
|
||||
expect(logBody.embeds?.[0]?.title).toBe("owner/repo");
|
||||
expect(logBody.embeds?.[0]?.description).toContain("push");
|
||||
expect(logBody.embeds?.[0]?.color).toBe(0x3fb950);
|
||||
expect(logBody.embeds?.[0]?.fields?.[0]?.value).toContain("✅ Push Route → 111");
|
||||
expect(logBody.embeds?.[0]?.fields?.[1]?.value).toBe("deliv-1");
|
||||
@@ -460,8 +461,6 @@ describe("dispatchEvent fallback routing", () => {
|
||||
const parsed = JSON.parse(b) as { embeds?: Array<{ title?: string }> };
|
||||
return parsed.embeds?.[0]?.title ?? "";
|
||||
});
|
||||
expect(titles.sort()).toEqual(
|
||||
["owner/repo: 推送了 1 个提交", "owner/repo: Pushed 1 commit"].sort(),
|
||||
);
|
||||
expect(titles.sort()).toEqual(["owner/repo", "owner/repo"].sort());
|
||||
});
|
||||
});
|
||||
@@ -25,7 +25,7 @@ describe("telegram renderNeutralMessage", () => {
|
||||
};
|
||||
const out = renderNeutralMessage(message);
|
||||
expect(out).toContain(
|
||||
'<b><a href="https://github.com/acme/widget">acme/widget: Add feature</a></b>',
|
||||
'<b><a href="https://github.com/acme/widget">acme/widget</a>: Add feature</b>',
|
||||
);
|
||||
expect(out).toContain("<b>Status</b>: success");
|
||||
expect(out).toContain("<i>acme/widget</i>");
|
||||
|
||||
@@ -236,9 +236,9 @@ describe("processWebhook", () => {
|
||||
const parsed = JSON.parse(sent[0]!.body) as {
|
||||
embeds?: Array<{ title?: string; color?: number; description?: string }>;
|
||||
};
|
||||
expect(parsed.embeds?.[0]?.title).toBe("acme/widget: Deploy failed");
|
||||
expect(parsed.embeds?.[0]?.title).toBe("acme/widget");
|
||||
expect(parsed.embeds?.[0]?.color).toBe(0xf85149);
|
||||
expect(parsed.embeds?.[0]?.description).toBe("prod down");
|
||||
expect(parsed.embeds?.[0]?.description).toBe("Deploy failed\nprod down");
|
||||
});
|
||||
|
||||
it("rejects custom webhooks without a signature header", async () => {
|
||||
|
||||
Reference in new issue
Block a user