fix: resolve review issues for Slack target type
All checks were successful
check / check (push) Successful in 1m53s
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user