Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Phoen committed Nov 27, 2021
1 parent 9d7697c commit 67b34ad
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,3 +318,18 @@ func TestDeleteDashboardCanFail(t *testing.T) {

req.Error(err)
}

func TestDeletingANonExistingDashboardReturnsSpecificError(t *testing.T) {
req := require.New(t)
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNotFound)
fmt.Fprintln(w, `{"message": "oh noes, does not exist"}`)
}))
defer ts.Close()

client := NewClient(http.DefaultClient, ts.URL)

err := client.DeleteDashboard(context.TODO(), "some uid")

req.Equal(ErrDashboardNotFound, err)
}

0 comments on commit 67b34ad

Please sign in to comment.