Skip to content
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

Ref(SPV-1216) Fix unit tests status codes #24

Merged
merged 13 commits into from
Dec 2, 2024

Conversation

ac4ch
Copy link

@ac4ch ac4ch commented Nov 29, 2024

Pull Request Checklist

  • πŸ“– I created my PR using provided : CODE_STANDARDS
  • πŸ“– I have read the short Code of Conduct: CODE_OF_CONDUCT
  • 🏠 I tested my changes locally.
  • βœ… I have provided tests for my changes.
  • πŸ“ I have used conventional commits.
  • πŸ“— I have updated any related documentation.
  • πŸ’Ύ PR was issued based on the Github or Jira issue.

Copy link

Manual Tests

ℹ️ Remember to ask team members to perform manual tests and to assign tested label after testing.

…b.com:4chain-ag/spv-wallet-go-client-v2 into refactor/SPV-1216/Fix_unit_tests_status_codes
@ac4ch ac4ch requested a review from chris-4chain November 29, 2024 10:21
@mgosek-4chain
Copy link

Here's the solution how we can simplify error checks by using only errors.Is.

#26

@mgosek-4chain
Copy link

mgosek-4chain commented Nov 29, 2024

There is still one thing to improve which I forgot to do in my PR:

  1. Add such stub response per each testpkg:
func NewInternalServerSPVError() models.SPVError {
	return models.SPVError{
		Message:    http.StatusText(http.StatusInternalServerError),
		StatusCode: http.StatusInternalServerError,
		Code:       models.UnknownErrorCode,
	}
}
  1. Per each unit test add case where SPVError JSON is returned for 500 HTTP status code

For ex.

	"HTTP GET /api/v1/configs/shared response: 500": {
			expectedErr: configstest.NewInternalServerSPVError(),
			responder:   httpmock.NewJsonResponderOrPanic(http.StatusInternalServerError, configstest.NewInternalServerSPVError()),
		},

@ac4ch ac4ch enabled auto-merge (squash) December 2, 2024 05:55
@ac4ch ac4ch merged commit f89e3d8 into main Dec 2, 2024
8 checks passed
@ac4ch ac4ch deleted the refactor/SPV-1216/Fix_unit_tests_status_codes branch December 2, 2024 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants