Remove private function tests from params_test.go#142
Conversation
Co-authored-by: yegor256 <526301+yegor256@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR improves test organization by removing misplaced tests for a private function. The params_test.go file previously contained 7 test functions (TestMask_*) that were testing the private mask() function from refrax_client.go, which was inappropriate since test files should only test the public API of their corresponding source file.
Key changes:
- Removed 7 test functions (
TestMask_ReturnsEmptyForEmptyTokenthroughTestMask_ShowsThreeCharacters) that tested the privatemask()function - Retained all 14
TestNewMockParams_*tests that properly test the publicNewMockParams()function fromparams.go
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| params := NewMockParams() | ||
| assert.Equal(t, "", params.Output, "output must be empty") | ||
| } |
There was a problem hiding this comment.
While removing tests for the private mask() function from this file is correct (as it doesn't belong in params_test.go), the mask() function in refrax_client.go is now completely untested. The mask() function is used for security purposes to mask sensitive tokens in debug logs (line 328 of refrax_client.go). Consider adding tests for this function in refrax_client_test.go to ensure it properly masks tokens of various lengths, especially since it handles a security-sensitive operation.
The
params_test.gofile contained tests for themask()function, which is a private function defined inrefrax_client.go. Private functions should not be tested separately, and these tests were unrelated to the params package.Changes:
TestMask_*test functions frominternal/client/params_test.goTestNewMockParams_*tests which properly test the public API of params.go✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.