Skip to content

Commit

Permalink
Merge pull request #138 from sugyan/update-tests
Browse files Browse the repository at this point in the history
Update TestEventMarshaling
  • Loading branch information
sugyan authored Mar 26, 2019
2 parents be45491 + 023be1f commit 3cff747
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions linebot/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,27 +682,19 @@ func TestEventMarshaling(t *testing.T) {
t.Fatal(err)
}
for i, want := range testCases.Events {
gotJSON, err := json.Marshal(webhookTestWantEvents[i])
if err != nil {
t.Fatal(err)
t.Error(err)
continue
}
e := webhookTestWantEvents[i]
switch e.Message.(type) {
case *FileMessage:
// skip
default:
gotJSON, err := json.Marshal(&e)
if err != nil {
t.Error(err)
continue
}
got := map[string]interface{}{}
err = json.Unmarshal(gotJSON, &got)
if err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(got, want) {
t.Errorf("Event marshal %d %v; want %v", i, got, want)
}
got := map[string]interface{}{}
err = json.Unmarshal(gotJSON, &got)
if err != nil {
t.Error(err)
continue
}
if !reflect.DeepEqual(got, want) {
t.Errorf("Event marshal %d %v; want %v", i, got, want)
}
}
}
Expand Down

0 comments on commit 3cff747

Please sign in to comment.