FIx shared structs + add better debugging/linting (#379)

* fix: Fixes issues w/ shared pointers to structs (#378)
* feat: Adds even better debugging and linting support (#376)

This is a #PATCH release.
This commit is contained in:
Harrison (Harry) Cramer
2024-09-16 17:06:40 -04:00
committed by GitHub
parent c3d7f26e3c
commit 5c9b88db4f
31 changed files with 191 additions and 155 deletions

View File

@@ -31,7 +31,7 @@ func TestCreateMr(t *testing.T) {
request := makeRequest(t, http.MethodPost, "/create_mr", testCreateMrRequestData)
svc := middleware(
mergeRequestCreatorService{testProjectData, fakeMergeCreatorClient{}},
withPayloadValidation(methodToPayload{http.MethodPost: &CreateMrRequest{}}),
withPayloadValidation(methodToPayload{http.MethodPost: newPayload[CreateMrRequest]}),
withMethodCheck(http.MethodPost),
)
data := getSuccessData(t, svc, request)
@@ -42,7 +42,7 @@ func TestCreateMr(t *testing.T) {
request := makeRequest(t, http.MethodPost, "/create_mr", testCreateMrRequestData)
svc := middleware(
mergeRequestCreatorService{testProjectData, fakeMergeCreatorClient{testBase{errFromGitlab: true}}},
withPayloadValidation(methodToPayload{http.MethodPost: &CreateMrRequest{}}),
withPayloadValidation(methodToPayload{http.MethodPost: newPayload[CreateMrRequest]}),
withMethodCheck(http.MethodPost),
)
data, _ := getFailData(t, svc, request)
@@ -53,7 +53,7 @@ func TestCreateMr(t *testing.T) {
request := makeRequest(t, http.MethodPost, "/create_mr", testCreateMrRequestData)
svc := middleware(
mergeRequestCreatorService{testProjectData, fakeMergeCreatorClient{testBase{status: http.StatusSeeOther}}},
withPayloadValidation(methodToPayload{http.MethodPost: &CreateMrRequest{}}),
withPayloadValidation(methodToPayload{http.MethodPost: newPayload[CreateMrRequest]}),
withMethodCheck(http.MethodPost),
)
data, _ := getFailData(t, svc, request)
@@ -66,7 +66,7 @@ func TestCreateMr(t *testing.T) {
request := makeRequest(t, http.MethodPost, "/create_mr", reqData)
svc := middleware(
mergeRequestCreatorService{testProjectData, fakeMergeCreatorClient{}},
withPayloadValidation(methodToPayload{http.MethodPost: &CreateMrRequest{}}),
withPayloadValidation(methodToPayload{http.MethodPost: newPayload[CreateMrRequest]}),
withMethodCheck(http.MethodPost),
)
data, _ := getFailData(t, svc, request)
@@ -80,7 +80,7 @@ func TestCreateMr(t *testing.T) {
request := makeRequest(t, http.MethodPost, "/create_mr", reqData)
svc := middleware(
mergeRequestCreatorService{testProjectData, fakeMergeCreatorClient{}},
withPayloadValidation(methodToPayload{http.MethodPost: &CreateMrRequest{}}),
withPayloadValidation(methodToPayload{http.MethodPost: newPayload[CreateMrRequest]}),
withMethodCheck(http.MethodPost),
)
data, _ := getFailData(t, svc, request)