Fix tests to use data from Conversation, not Timelines.

pull/137/head
Ollivier Robert 2021-04-15 15:02:52 +02:00 committed by mattn
parent 932595ebec
commit 2ae3a80997
1 changed files with 4 additions and 3 deletions

View File

@ -372,7 +372,7 @@ func TestGetTimelinePublic(t *testing.T) {
func TestGetTimelineDirect(t *testing.T) { func TestGetTimelineDirect(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, `[{"content": "direct"}, {"content": "status"}]`) fmt.Fprintln(w, `[{"id": "4", "unread":false, "last_status" : {"content": "zzz"}}, {"id": "3", "unread":true, "last_status" : {"content": "bar"}}]`)
})) }))
defer ts.Close() defer ts.Close()
@ -381,13 +381,14 @@ func TestGetTimelineDirect(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("should not be fail: %v", err) t.Fatalf("should not be fail: %v", err)
} }
t.Logf("%#v", tl)
if len(tl) != 2 { if len(tl) != 2 {
t.Fatalf("result should be two: %d", len(tl)) t.Fatalf("result should be two: %d", len(tl))
} }
if tl[0].Content != "direct" { if tl[0].Content != "zzz" {
t.Fatalf("want %q but %q", "foo", tl[0].Content) t.Fatalf("want %q but %q", "foo", tl[0].Content)
} }
if tl[1].Content != "status" { if tl[1].Content != "bar" {
t.Fatalf("want %q but %q", "bar", tl[1].Content) t.Fatalf("want %q but %q", "bar", tl[1].Content)
} }
} }