Skip to content

Commit

Permalink
fix: [#31] added test case for invalid endpoints map
Browse files Browse the repository at this point in the history
  • Loading branch information
jherrerasbp committed Dec 21, 2024
1 parent 5978f9b commit b5ccb45
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cmd/mcvs-stub-server/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,17 @@ func TestListHandlerInvalidMethod(t *testing.T) {
handler.list(httptestRecorder, httptestRequest)
assert.Equal(t, http.StatusMethodNotAllowed, httptestRecorder.Code)
}

func TestListHandlerInvalidEndpointsMap(t *testing.T) {
// given
handler := newHandler()
handler.endpoints["/bad"] = func() {}

// when
httptestRecorder := httptest.NewRecorder()
httptestRequest := httptest.NewRequest("GET", "/list", nil)

// then
handler.list(httptestRecorder, httptestRequest)
assert.Equal(t, http.StatusInternalServerError, httptestRecorder.Code)
}

0 comments on commit b5ccb45

Please sign in to comment.