From a4d531815ff4e896b9f26bccd5fcdef0f4665610 Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Thu, 26 Oct 2017 15:00:17 +0900 Subject: [PATCH] add test for CustomEmoji --- status_test.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/status_test.go b/status_test.go index 7c1ac29..283e290 100644 --- a/status_test.go +++ b/status_test.go @@ -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) {