diff --git a/comment_test.go b/comment_test.go index 25ec9df..1a7d5f2 100644 --- a/comment_test.go +++ b/comment_test.go @@ -3,8 +3,8 @@ package kintone import "testing" func TestDecodeRecordComments(t *testing.T) { - j := []byte(` -{"comments":[{"id":"2","text":"ほげほげ","createdAt":"2016-11-07T19:53:32Z","creator":{"code":"xxx.tat","name":"さんぷる"},"mentions":[]},{"id":"1","text":"ふがふが","createdAt":"2016-11-07T19:53:27Z","creator":{"code":"xxx.tat","name":"さんぷる"},"mentions":[]}],"older":false,"newer":false} + j := []byte(` +{"comments":[{"id":"2","text":"ほげほげ","createdAt":"2016-11-07T19:53:32Z","creator":{"code":"xxx.tat","name":"さんぷる"},"mentions":[{"code":"wolf","type":"USER"}]},{"id":"1","text":"ふがふが","createdAt":"2016-11-07T19:53:27Z","creator":{"code":"xxx.tat","name":"さんぷる"},"mentions":[]}],"older":false,"newer":false} `) rec, err := DecodeRecordComments(j) @@ -20,4 +20,14 @@ func TestDecodeRecordComments(t *testing.T) { if rec[0].Text != "ほげほげ" { t.Errorf("comment text mismatch. actual %v", rec[0].Text) } + + if rec[0].CreatedAt != "2016-11-07T19:53:32Z" { + t.Errorf("comment createdat mismatch. actual %v", rec[0].CreatedAt) + } + if rec[0].Creator.Code != "xxx.tat" { + t.Errorf("comment creator mismatch. actual %v", rec[0].Creator.Code) + } + if rec[0].Mentions[0].Code != "wolf" { + t.Errorf("comment mention-code mismatch. actual %v", rec[0].Mentions[0].Code) + } }