-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Rewrite new_test.go removing duplications #2440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Conversation
|
@Umang01-hash please see this |
|
@Umang01-hash I created a factory function to generate the service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@0xEbrahim The changes in all the other files apart from pkg/gofr/service/new_test.go are not necessary and also don't fall in the scope of this PR. Can you please remove them?
b30fbe4 to
533fe02
Compare
533fe02 to
bbaddcc
Compare
|
@Umang01-hash I think it is alright now, unless you have more comments |
Pull Request Template
related: #2436
issue: #2434
Description:
This PR refactors the HTTP service test suite to eliminate repetitive response validation logic and improve consistency across test cases.
It also fixes a mismatch between the expected and actual HTTP methods in one of the tests (previously PUT was expected instead of PATCH).
Breaking Changes (if applicable):
Added
validateResponseTest Helperpkg/gofr/service/new_test.got.Helper()to mark it as a testing helper and satisfy the thelper linter rule.defer resp.Body.Close()).require.NoError,assert.NotNil, etc.).hasErrorflag to differentiate between positive and negative test cases.Refactored All HTTP Method Tests
validateResponsecalls.Fixed HTTP Method Assertion
http.MethodPutwhile the service was usingPATCH.Additional Information:
Checklist:
goimportandgolangci-lint.Thank you for your contribution!