Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/internal testing #194

Merged
merged 10 commits into from
Mar 24, 2023
Prev Previous commit
Next Next commit
has error checks
  • Loading branch information
Rex Posadas committed Mar 21, 2023
commit b97ddde3f3a3fadb5971219697aa797a53e68f5e
4 changes: 1 addition & 3 deletions api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,7 @@ func TestRequestError(t *testing.T) {
c := NewClientWithConfig(config)
ctx := context.Background()
_, err = c.ListEngines(ctx)
if err == nil {
t.Fatal("ListEngines did not fail")
}
checks.HasError(t, err, "ListEngines did not fail")

var reqErr *RequestError
if !errors.As(err, &reqErr) {
Expand Down
7 changes: 7 additions & 0 deletions internal/test/checks/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,10 @@ func NoError(t *testing.T, err error, message ...string) {
t.Error(err, message)
}
}

func HasError(t *testing.T, err error, message ...string) {
t.Helper()
if err == nil {
t.Error(err, message)
}
}