github.com/companieshouse/lfp-pay-api@v0.0.0-20230203133422-0ca455cd79f9/handlers/register_test.go (about) 1 package handlers 2 3 import ( 4 "net/http" 5 "net/http/httptest" 6 "testing" 7 8 "github.com/companieshouse/lfp-pay-api/config" 9 "github.com/companieshouse/lfp-pay-api/mocks" 10 "github.com/golang/mock/gomock" 11 "github.com/gorilla/mux" 12 13 . "github.com/smartystreets/goconvey/convey" 14 ) 15 16 func TestUnitRegisterRoutes(t *testing.T) { 17 Convey("Register routes", t, func() { 18 router := mux.NewRouter() 19 mockCtrl := gomock.NewController(t) 20 defer mockCtrl.Finish() 21 mockService := mocks.NewMockService(mockCtrl) 22 Register(router, &config.Config{}, mockService) 23 24 So(router.GetRoute("healthcheck"), ShouldNotBeNil) 25 So(router.GetRoute("healthcheck-finance-system"), ShouldNotBeNil) 26 So(router.GetRoute("get-penalties"), ShouldNotBeNil) 27 So(router.GetRoute("create-payable"), ShouldNotBeNil) 28 So(router.GetRoute("get-payable"), ShouldNotBeNil) 29 So(router.GetRoute("get-payment-details"), ShouldNotBeNil) 30 So(router.GetRoute("mark-as-paid"), ShouldNotBeNil) 31 }) 32 } 33 34 func TestUnitGetHealthCheck(t *testing.T) { 35 Convey("Get HealthCheck", t, func() { 36 req := httptest.NewRequest("GET", "/healthcheck", nil) 37 w := httptest.NewRecorder() 38 healthCheck(w, req) 39 So(w.Code, ShouldEqual, http.StatusOK) 40 }) 41 }