Skip to content

Commit

Permalink
add more unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabrina committed Jan 27, 2020
1 parent 31f386e commit 3fcc899
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion playstore/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ func TestNew(t *testing.T) {
t.Errorf("got %v\nwant %v", err, expected)
}

_, actual := New(nil)
if actual == nil || actual.Error() != "unexpected end of JSON input" {
t.Errorf("got %v\nwant %v", actual, expected)
}

_, err = New(jsonKey)
if err != nil {
t.Errorf("got %#v", err)
Expand All @@ -60,7 +65,7 @@ func TestNewWithClient(t *testing.T) {
}
}

func TestNewWithNoClient(t *testing.T) {
func TestNewWithClientErrors(t *testing.T) {
t.Parallel()
expected := errors.New("client is nil")

Expand All @@ -69,6 +74,14 @@ func TestNewWithNoClient(t *testing.T) {
t.Errorf("got %v\nwant %v", actual, expected)
}

ctx := context.Background()
httpClient := urlfetch.Client(ctx)

_, actual = NewWithClient(nil, httpClient)
if actual == nil || actual.Error() != "unexpected end of JSON input" {
t.Errorf("got %v\nwant %v", actual, expected)
}

}

func TestAcknowledgeSubscription(t *testing.T) {
Expand Down

0 comments on commit 3fcc899

Please sign in to comment.