fix: resolve review issues for Slack target type
All checks were successful
check / check (push) Successful in 1m53s

- Fix duplicate name="url" form fields by adding :disabled binding
  to each URL input so only the active target type's field submits
- Fix message formatting to use Slack mrkdwn (*bold*) instead of
  Markdown (**bold**) and remove language hint from code blocks
- Fix README line exceeding 80-column hard wrap
This commit is contained in:
user
2026-03-17 03:47:12 -07:00
parent 5f18e7c7bf
commit a735252ffa
4 changed files with 18 additions and 15 deletions

View File

@@ -973,10 +973,11 @@ func TestFormatSlackMessage_JSONBody(t *testing.T) {
msg := FormatSlackMessage(event)
assert.Contains(t, msg, "**Webhook Event Received**")
assert.Contains(t, msg, "*Webhook Event Received*")
assert.Contains(t, msg, "`POST`")
assert.Contains(t, msg, "`application/json`")
assert.Contains(t, msg, "```json")
assert.Contains(t, msg, "```")
assert.NotContains(t, msg, "```json")
// Pretty-printed JSON should have indentation
assert.Contains(t, msg, ` "action": "push"`)
assert.Contains(t, msg, ` "repo": "test/repo"`)
@@ -994,7 +995,7 @@ func TestFormatSlackMessage_NonJSONBody(t *testing.T) {
msg := FormatSlackMessage(event)
assert.Contains(t, msg, "**Webhook Event Received**")
assert.Contains(t, msg, "*Webhook Event Received*")
assert.Contains(t, msg, "```\nhello world plain text\n```")
// Should NOT have ```json marker for non-JSON
assert.NotContains(t, msg, "```json")
@@ -1094,8 +1095,10 @@ func TestDeliverSlack_Success(t *testing.T) {
// Verify the Slack payload contains the expected message
var slackPayload map[string]string
require.NoError(t, json.Unmarshal([]byte(receivedBody), &slackPayload))
assert.Contains(t, slackPayload["text"], "**Webhook Event Received**")
assert.Contains(t, slackPayload["text"], "```json")
assert.Contains(t, slackPayload["text"], "*Webhook Event Received*")
assert.NotContains(t, slackPayload["text"], "**Webhook Event Received**")
assert.Contains(t, slackPayload["text"], "```")
assert.NotContains(t, slackPayload["text"], "```json")
}
func TestDeliverSlack_Failure(t *testing.T) {