summaryrefslogtreecommitdiffstats
path: root/model/incoming_webhook_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'model/incoming_webhook_test.go')
-rw-r--r--model/incoming_webhook_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/model/incoming_webhook_test.go b/model/incoming_webhook_test.go
index f6baca988..36f8ed6e6 100644
--- a/model/incoming_webhook_test.go
+++ b/model/incoming_webhook_test.go
@@ -230,3 +230,17 @@ func TestIncomingWebhookRequestFromJson(t *testing.T) {
}
}
}
+
+func TestIncomingWebhookNullArrayItems(t *testing.T) {
+ payload := `{"attachments":[{"fields":[{"title":"foo","value":"bar","short":true}, null]}, null]}`
+ iwr := IncomingWebhookRequestFromJson(strings.NewReader(payload))
+ if iwr == nil {
+ t.Fatal("IncomingWebhookRequest should not be nil")
+ }
+ if len(iwr.Attachments) != 1 {
+ t.Fatalf("expected one attachment")
+ }
+ if len(iwr.Attachments[0].Fields) != 1 {
+ t.Fatalf("expected one field")
+ }
+}