Skip to content

Commit c847987

Browse files
pontusarfwedsondrnic
authored andcommitted
Feature link names (#51)
* added linked names and fixed previous merge error * removed unused test method
1 parent 2978d64 commit c847987

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

out

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ text="$(jq -r '(.params.text // "${TEXT_FILE_CONTENT}")' < "${payload}")"
2323
username="$(jq '(.params.username // null)' < "${payload}")"
2424
icon_url="$(jq '(.params.icon_url // null)' < "${payload}")"
2525
icon_emoji="$(jq '(.params.icon_emoji // null)' < "${payload}")"
26+
link_names="$(jq -r '(.params.link_names // false)' < "${payload}")"
2627

2728
channels="$(jq -r '(.params.channel // null)' < "${payload}")"
2829
channel_file="$(jq -r '(.params.channel_file // null)' < "${payload}")"
@@ -115,6 +116,7 @@ then
115116
{
116117
"text": ${text_interpolated},
117118
"username": ${username},
119+
"link_names": ${link_names},
118120
"icon_url": ${icon_url},
119121
"icon_emoji": ${icon_emoji},
120122
"channel": ${channel},

test/all.sh

+21-14
Original file line numberDiff line numberDiff line change
@@ -53,68 +53,74 @@ test combined_text_template_and_file | jq -e "
5353
.body.channel == null and
5454
.body.icon_url == null and
5555
.body.icon_emoji == null and
56+
.body.link_names == false and
5657
.body.username == $(echo $username | jq -R .) and
5758
.body.text == \"${base_text}\n${sample_text}\" and
5859
.body.attachments == null and
59-
( .body | keys | contains([\"channel\",\"icon_emoji\",\"icon_url\",\"username\",\"text\",\"attachments\"]) ) and
60-
( .body | keys | length == 6 )"
60+
( .body | keys | contains([\"channel\",\"icon_emoji\",\"icon_url\",\"username\",\"link_names\",\"text\",\"attachments\"]) ) and
61+
( .body | keys | length == 7 )"
6162

6263

6364
test combined_text_template_and_file_empty | jq -e "
6465
.webhook_url == $(echo $webhook_url | jq -R .) and
6566
.body.channel == null and
6667
.body.icon_url == null and
6768
.body.icon_emoji == null and
69+
.body.link_names == false and
6870
.body.username == $(echo $username | jq -R .) and
6971
.body.text == \"${base_text}\n${missing_text}\n\" and
7072
.body.attachments == null and
71-
( .body | keys | contains([\"channel\",\"icon_emoji\",\"icon_url\",\"username\",\"text\",\"attachments\"]) ) and
72-
( .body | keys | length == 6 )"
73+
( .body | keys | contains([\"channel\",\"icon_emoji\",\"icon_url\",\"username\",\"link_names\",\"text\",\"attachments\"]) ) and
74+
( .body | keys | length == 7 )"
7375

7476

7577
test combined_text_template_and_file_missing | jq -e "
7678
.webhook_url == $(echo $webhook_url | jq -R .) and
7779
.body.channel == null and
7880
.body.icon_url == null and
7981
.body.icon_emoji == null and
82+
.body.link_names == false and
8083
.body.username == $(echo $username | jq -R .) and
8184
.body.text == \"${base_text}\n${missing_text}\n\" and
8285
.body.attachments == null and
83-
( .body | keys | contains([\"channel\",\"icon_emoji\",\"icon_url\",\"username\",\"text\",\"attachments\"]) ) and
84-
( .body | keys | length == 6 )"
86+
( .body | keys | contains([\"channel\",\"icon_emoji\",\"icon_url\",\"username\",\"link_names\",\"text\",\"attachments\"]) ) and
87+
( .body | keys | length == 7 )"
8588

8689
test text | jq -e "
8790
.webhook_url == $(echo $webhook_url | jq -R .) and
8891
.body.channel == null and
8992
.body.icon_url == null and
9093
.body.icon_emoji == null and
94+
.body.link_names == false and
9195
.body.username == $(echo $username | jq -R .) and
9296
.body.text == \"Inline static \`text\`\n\" and
9397
.body.attachments == null and
94-
( .body | keys | contains([\"channel\",\"icon_emoji\",\"icon_url\",\"username\",\"text\",\"attachments\"]) ) and
95-
( .body | keys | length == 6 )"
98+
( .body | keys | contains([\"channel\",\"icon_emoji\",\"icon_url\",\"username\",\"link_names\",\"text\",\"attachments\"]) ) and
99+
( .body | keys | length == 7 )"
96100

97101
test text_file | jq -e "
98102
.webhook_url == $(echo $webhook_url | jq -R .) and
99103
.body.channel == null and
100104
.body.icon_url == null and
101105
.body.icon_emoji == null and
106+
.body.link_names == false and
102107
.body.username == $(echo $username | jq -R .) and
103108
.body.text == \"${sample_text}\" and
104109
.body.attachments == null and
105-
( .body | keys | contains([\"channel\",\"icon_emoji\",\"icon_url\",\"username\",\"text\",\"attachments\"]) ) and
106-
( .body | keys | length == 6 )"
110+
( .body | keys | contains([\"channel\",\"icon_emoji\",\"icon_url\",\"username\",\"link_names\",\"text\",\"attachments\"]) ) and
111+
( .body | keys | length == 7 )"
107112

108113
test text_file_empty | jq -e "
109114
.webhook_url == $(echo $webhook_url | jq -R .) and
110115
.body.channel == null and
111116
.body.icon_url == null and
112117
.body.icon_emoji == null and
118+
.body.link_names == false and
113119
.body.username == $(echo $username | jq -R .) and
114120
.body.text == \"${missing_text}\n\" and
115121
.body.attachments == null and
116-
( .body | keys | contains([\"channel\",\"icon_emoji\",\"icon_url\",\"username\",\"text\",\"attachments\"]) ) and
117-
( .body | keys | length == 6 )"
122+
( .body | keys | contains([\"channel\",\"icon_emoji\",\"icon_url\",\"username\",\"link_names\",\"text\",\"attachments\"]) ) and
123+
( .body | keys | length == 7 )"
118124

119125
test text_file_empty_suppress | jq -e "
120126
( . | keys | length == 1 ) and
@@ -183,10 +189,11 @@ test multiple_channels | jq -e "
183189
.body.channel == \"#another_channel\" and
184190
.body.icon_url == null and
185191
.body.icon_emoji == null and
192+
.body.link_names == false and
186193
.body.username == $(echo $username | jq -R .) and
187194
.body.text == \"Inline static text\n\" and
188-
( .body | keys | contains([\"attachments\", \"channel\",\"icon_emoji\",\"icon_url\",\"username\",\"text\"]) ) and
189-
( .body | keys | length == 6 ) and
195+
( .body | keys | contains([\"attachments\", \"channel\",\"icon_emoji\",\"icon_url\",\"username\",\"link_names\",\"text\"]) ) and
196+
( .body | keys | length == 7 ) and
190197
.body.attachments == null"
191198

192199

0 commit comments

Comments
 (0)