test: Add unit tests for documentation generation#597
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #597 +/- ##
=========================================
- Coverage 10.99% 7.17% -3.82%
=========================================
Files 173 260 +87
Lines 8671 12845 +4174
=========================================
- Hits 953 922 -31
- Misses 7612 11815 +4203
- Partials 106 108 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Linter Issues
Running golangci-lint run ./doc/... reveals issues that need to be fixed:
-
Missing license header (
goheader):doc/doc_test.go:1:1: Missed header for checkAdd the Apache 2.0 license header at the top of
doc_test.go. -
File permissions (
gosec- 3 occurrences):doc/doc_test.go:130, 152, 166: G306: Expect WriteFile permissions to be 0600 or lessChange
os.WriteFile(..., 0644)toos.WriteFile(..., 0600)in all test cases. -
Whitespace issue:
doc/doc_test.go:231: unnecessary leading newlineRemove the blank line after
func TestPreblock(t *testing.T) {.
bupd
left a comment
There was a problem hiding this comment.
@rkcoder101 Thanks for your contribution
Please fix the lint issues - https://github.com/goharbor/harbor-cli/actions/runs/21089411887/attempts/1#summary-60658461489
otherwise /lgtm
|
@bupd Thanks for the review, I have taken care of the linting issues in the latest commit. |
|
@rkcoder101 please rebase onto the main branch. |
…ock functions of doc.go. Did some very minor changes in doc.go wherever required Signed-off-by: Rayyan Khan <rayyanrehman101@gmail.com>
…f doc.go. Did some very minor changes in doc.go wherever required Signed-off-by: Rayyan Khan <rayyanrehman101@gmail.com>
Description
This PR introduces unit tests for the documentation generation utility (
doc/doc.goanddoc/man-docs/man_doc.go).Relates to #591
Test Coverage Checklist
The following functions in
doc.goare targeted for unit tests:preblockprintOptionsMarkdownCustomlinkHandlerhasSeeAlsogetWeightMarkdownCustomTreeDocsThe following functions in
man_doc.goare targeted for unit tests:ManDoccleanManPages