summaryrefslogtreecommitdiffstats
path: root/model/command_response_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'model/command_response_test.go')
-rw-r--r--model/command_response_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/model/command_response_test.go b/model/command_response_test.go
index b57a77608..df478ff2c 100644
--- a/model/command_response_test.go
+++ b/model/command_response_test.go
@@ -82,3 +82,17 @@ func TestCommandResponseFromJson(t *testing.T) {
t.Fatal("should've received correct second attachment value")
}
}
+
+func TestCommandResponseNullArrayItems(t *testing.T) {
+ payload := `{"attachments":[{"fields":[{"title":"foo","value":"bar","short":true}, null]}, null]}`
+ cr := CommandResponseFromJson(strings.NewReader(payload))
+ if cr == nil {
+ t.Fatal("CommandResponse should not be nil")
+ }
+ if len(cr.Attachments) != 1 {
+ t.Fatalf("expected one attachment")
+ }
+ if len(cr.Attachments[0].Fields) != 1 {
+ t.Fatalf("expected one field")
+ }
+}