Skip to content

Commit

Permalink
Change push-type tests for better coverage (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
sideshow authored Aug 17, 2019
1 parent 88a36b9 commit 49125e3
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,17 +171,14 @@ func TestHeaders(t *testing.T) {
n.Topic = "com.testapp"
n.Priority = 10
n.Expiration = time.Now()
n.PushType = apns.PushTypeBackground
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, n.ApnsID, r.Header.Get("apns-id"))
assert.Equal(t, n.CollapseID, r.Header.Get("apns-collapse-id"))
assert.Equal(t, "10", r.Header.Get("apns-priority"))
assert.Equal(t, n.Topic, r.Header.Get("apns-topic"))
assert.Equal(t, fmt.Sprintf("%v", n.Expiration.Unix()), r.Header.Get("apns-expiration"))
if n.PushType == "" {
assert.Equal(t, "alert", r.Header.Get("apns-push-type"))
} else {
assert.Equal(t, n.PushType, r.Header.Get("apns-push-type"))
}
assert.Equal(t, "background", r.Header.Get("apns-push-type"))
}))
defer server.Close()
_, err := mockClient(server.URL).Push(n)
Expand Down

0 comments on commit 49125e3

Please sign in to comment.