@@ -124,6 +124,7 @@ func TestAlertProvider_Send(t *testing.T) {
124124func TestAlertProvider_buildRequestBody (t * testing.T ) {
125125 firstDescription := "description-1"
126126 secondDescription := "description-2"
127+ descriptionWithLink := "[link](https://example.org/)"
127128 scenarios := []struct {
128129 Name string
129130 Provider AlertProvider
@@ -137,29 +138,36 @@ func TestAlertProvider_buildRequestBody(t *testing.T) {
137138 Provider : AlertProvider {DefaultConfig : Config {ID : "123" }},
138139 Alert : alert.Alert {Description : & firstDescription , SuccessThreshold : 5 , FailureThreshold : 3 },
139140 Resolved : false ,
140- ExpectedBody : "{\" chat_id\" :\" 123\" ,\" text\" :\" ⛑ *Gatus* \\ nAn alert for *endpoint-name* has been triggered:\\ n—\\ n _healthcheck failed 3 time(s) in a row_\\ n— \\ n*Description* \\ n_description-1_ \\ n\\ n*Condition results*\\ n❌ - `[CONNECTED] == true`\\ n❌ - `[STATUS] == 200`\\ n\" ,\" parse_mode\" :\" MARKDOWN\" }" ,
141+ ExpectedBody : "{\" chat_id\" :\" 123\" ,\" text\" :\" ⛑ *Gatus* \\ nAn alert for *endpoint-name* has been triggered:\\ n—\\ n _healthcheck failed 3 time(s) in a row_\\ n— \\ n*Description* \\ ndescription-1 \\ n\\ n*Condition results*\\ n❌ - `[CONNECTED] == true`\\ n❌ - `[STATUS] == 200`\\ n\" ,\" parse_mode\" :\" MARKDOWN\" }" ,
141142 },
142143 {
143144 Name : "resolved" ,
144145 Provider : AlertProvider {DefaultConfig : Config {ID : "123" }},
145146 Alert : alert.Alert {Description : & secondDescription , SuccessThreshold : 5 , FailureThreshold : 3 },
146147 Resolved : true ,
147- ExpectedBody : "{\" chat_id\" :\" 123\" ,\" text\" :\" ⛑ *Gatus* \\ nAn alert for *endpoint-name* has been resolved:\\ n—\\ n _healthcheck passing successfully 5 time(s) in a row_\\ n— \\ n*Description* \\ n_description-2_ \\ n\\ n*Condition results*\\ n✅ - `[CONNECTED] == true`\\ n✅ - `[STATUS] == 200`\\ n\" ,\" parse_mode\" :\" MARKDOWN\" }" ,
148+ ExpectedBody : "{\" chat_id\" :\" 123\" ,\" text\" :\" ⛑ *Gatus* \\ nAn alert for *endpoint-name* has been resolved:\\ n—\\ n _healthcheck passing successfully 5 time(s) in a row_\\ n— \\ n*Description* \\ ndescription-2 \\ n\\ n*Condition results*\\ n✅ - `[CONNECTED] == true`\\ n✅ - `[STATUS] == 200`\\ n\" ,\" parse_mode\" :\" MARKDOWN\" }" ,
148149 },
149150 {
150151 Name : "resolved-with-no-conditions" ,
151152 NoConditions : true ,
152153 Provider : AlertProvider {DefaultConfig : Config {ID : "123" }},
153154 Alert : alert.Alert {Description : & secondDescription , SuccessThreshold : 5 , FailureThreshold : 3 },
154155 Resolved : true ,
155- ExpectedBody : "{\" chat_id\" :\" 123\" ,\" text\" :\" ⛑ *Gatus* \\ nAn alert for *endpoint-name* has been resolved:\\ n—\\ n _healthcheck passing successfully 5 time(s) in a row_\\ n— \\ n*Description* \\ n_description-2_ \\ n\" ,\" parse_mode\" :\" MARKDOWN\" }" ,
156+ ExpectedBody : "{\" chat_id\" :\" 123\" ,\" text\" :\" ⛑ *Gatus* \\ nAn alert for *endpoint-name* has been resolved:\\ n—\\ n _healthcheck passing successfully 5 time(s) in a row_\\ n— \\ n*Description* \\ ndescription-2 \\ n\" ,\" parse_mode\" :\" MARKDOWN\" }" ,
156157 },
157158 {
158159 Name : "send to topic" ,
159160 Provider : AlertProvider {DefaultConfig : Config {ID : "123" , TopicID : "7" }},
160161 Alert : alert.Alert {Description : & firstDescription , SuccessThreshold : 5 , FailureThreshold : 3 },
161162 Resolved : false ,
162- ExpectedBody : "{\" chat_id\" :\" 123\" ,\" text\" :\" ⛑ *Gatus* \\ nAn alert for *endpoint-name* has been triggered:\\ n—\\ n _healthcheck failed 3 time(s) in a row_\\ n— \\ n*Description* \\ n_description-1_ \\ n\\ n*Condition results*\\ n❌ - `[CONNECTED] == true`\\ n❌ - `[STATUS] == 200`\\ n\" ,\" parse_mode\" :\" MARKDOWN\" ,\" message_thread_id\" :\" 7\" }" ,
163+ ExpectedBody : "{\" chat_id\" :\" 123\" ,\" text\" :\" ⛑ *Gatus* \\ nAn alert for *endpoint-name* has been triggered:\\ n—\\ n _healthcheck failed 3 time(s) in a row_\\ n— \\ n*Description* \\ ndescription-1 \\ n\\ n*Condition results*\\ n❌ - `[CONNECTED] == true`\\ n❌ - `[STATUS] == 200`\\ n\" ,\" parse_mode\" :\" MARKDOWN\" ,\" message_thread_id\" :\" 7\" }" ,
164+ },
165+ {
166+ Name : "triggered with link in description" ,
167+ Provider : AlertProvider {DefaultConfig : Config {ID : "123" }},
168+ Alert : alert.Alert {Description : & descriptionWithLink , SuccessThreshold : 5 , FailureThreshold : 3 },
169+ Resolved : false ,
170+ ExpectedBody : "{\" chat_id\" :\" 123\" ,\" text\" :\" ⛑ *Gatus* \\ nAn alert for *endpoint-name* has been triggered:\\ n—\\ n _healthcheck failed 3 time(s) in a row_\\ n— \\ n*Description* \\ n[link](https://example.org/) \\ n\\ n*Condition results*\\ n❌ - `[CONNECTED] == true`\\ n❌ - `[STATUS] == 200`\\ n\" ,\" parse_mode\" :\" MARKDOWN\" }" ,
163171 },
164172 }
165173 for _ , scenario := range scenarios {
0 commit comments