add test for CustomEmoji

pull/65/merge
Yasuhiro Matsumoto 2017-10-26 15:00:17 +09:00
parent 1d165763fa
commit a4d531815f
1 changed files with 13 additions and 1 deletions

View File

@ -42,7 +42,7 @@ func TestGetStatus(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
return
}
fmt.Fprintln(w, `{"content": "zzz"}`)
fmt.Fprintln(w, `{"content": "zzz", "emojis":[{"shortcode":"💩", "url":"http://example.com", "static_url": "http://example.com/static"}]}`)
return
}))
defer ts.Close()
@ -64,6 +64,18 @@ func TestGetStatus(t *testing.T) {
if status.Content != "zzz" {
t.Fatalf("want %q but %q", "zzz", status.Content)
}
if len(status.Emojis) != 1 {
t.Fatal("should have emojis")
}
if status.Emojis[0].ShortCode != "💩" {
t.Fatalf("want %q but %q", "💩", status.Emojis[0])
}
if status.Emojis[0].URL != "http://example.com" {
t.Fatalf("want %q but %q", "💩", "https://example.com")
}
if status.Emojis[0].StaticURL != "http://example.com/static" {
t.Fatalf("want %q but %q", "💩", "https://example.com/static")
}
}
func TestGetStatusCard(t *testing.T) {