-
Notifications
You must be signed in to change notification settings - Fork 1
[CORE-75] Form Unit Test #37
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: main
Are you sure you want to change the base?
Conversation
YukinaMochizuki
left a comment
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.
I noticed that the Question service adopts table-driven testing, but Response and Submit do not. The current unit tests for Response and Submit suffer from low readability, which makes it difficult to quickly understand the intent of each test case. This will likely cause pain when modifying or adding test cases in the future.
Please at least adopt table-driven testing and include more failure cases to observe any unexpected behaviors, rather than only testing cases with valid formats. When using table-driven tests, please consider separating members such as name, param, setup, and validate, and make sure the name clearly describes the purpose of each test case.
For large mock (fake) structs, please use mockery to generate mocks. This helps maintain readability and future extensibility, while also reducing unnecessary boilerplate code, especially for methods that are not currently in use.
For the table-driven style, consider referring to unit_test.go.
| "go.uber.org/zap" | ||
| ) | ||
|
|
||
| type fakeQuerier struct { |
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.
For complex mock services, please use mockery.
5e51807 to
ab26aa7
Compare
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.
Some style issues have to be fix. Since Golang has a strict convention on naming, the abbreviated variables should be straighforward, or we often uses full names.
There are some similar cases in other lines that I have not listed below would also have to be fixed.
Type of changes
Purpose
Additional Information