Skip to content

Commit

Permalink
test: add pseudo-integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelbrm committed Sep 20, 2024
1 parent ed4c8ba commit 6494fe2
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions services/skus/controllers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1911,12 +1911,23 @@ func (suite *ControllersTestSuite) TestOrder_Cancel() {

uri := "/v1/orders-new/" + ord.ID.String()

req := httptest.NewRequest(http.MethodPost, uri, bytes.NewBuffer([]byte{}))
req := httptest.NewRequest(http.MethodDelete, uri, nil)

rw := httptest.NewRecorder()

oh := handlers.AppHandler(handler.NewOrder(suite.service).CreateNew)
srv := &http.Server{Addr: ":8080", Handler: oh}
oh := handler.NewOrder(suite.service)

rtr := chi.NewRouter()
subr := chi.NewRouter()
subr.Method(
http.MethodDelete,
"/{orderID}",
handlers.AppHandler(oh.Cancel),
)

rtr.Mount("/v1/orders-new", subr)

srv := &http.Server{Addr: ":8080", Handler: rtr}
srv.Handler.ServeHTTP(rw, req)

suite.Require().Equal(http.StatusOK, rw.Code)
Expand Down

0 comments on commit 6494fe2

Please sign in to comment.