Skip to content

test(security): achieve 100% test coverage for path.go#77

Merged
watany-dev merged 1 commit into
mainfrom
claude/improve-path-test-coverage-DoKEW
Jan 9, 2026
Merged

test(security): achieve 100% test coverage for path.go#77
watany-dev merged 1 commit into
mainfrom
claude/improve-path-test-coverage-DoKEW

Conversation

@watany-dev

Copy link
Copy Markdown
Owner

Add comprehensive tests for ValidateWorkingDirectory and
ValidatePathWithSymlinkResolution to cover all error branches:

  • Introduce testable function variables (filepathRel, filepathEvalSymlinks,
    osLstat) to enable mock-based testing of error paths
  • Add mock tests for filepath.Rel errors in ValidateWorkingDirectory
  • Add mock tests for os.Lstat errors in ValidatePathWithSymlinkResolution
  • Add mock tests for EvalSymlinks errors on both fullPath and basePath
  • Add mock tests for filepath.Rel errors in symlink resolution
  • Add tests for ValidateWorkingDirectory error propagation in
    ValidatePathWithSymlinkResolution

Coverage improved from 89.1% to 100%:

  • ValidateWorkingDirectory: 91.7% -> 100%
  • ValidatePathWithSymlinkResolution: 80.0% -> 100%

Add comprehensive tests for ValidateWorkingDirectory and
ValidatePathWithSymlinkResolution to cover all error branches:

- Introduce testable function variables (filepathRel, filepathEvalSymlinks,
  osLstat) to enable mock-based testing of error paths
- Add mock tests for filepath.Rel errors in ValidateWorkingDirectory
- Add mock tests for os.Lstat errors in ValidatePathWithSymlinkResolution
- Add mock tests for EvalSymlinks errors on both fullPath and basePath
- Add mock tests for filepath.Rel errors in symlink resolution
- Add tests for ValidateWorkingDirectory error propagation in
  ValidatePathWithSymlinkResolution

Coverage improved from 89.1% to 100%:
- ValidateWorkingDirectory: 91.7% -> 100%
- ValidatePathWithSymlinkResolution: 80.0% -> 100%
@watany-dev watany-dev merged commit 3c3ff61 into main Jan 9, 2026
4 checks passed
@watany-dev watany-dev deleted the claude/improve-path-test-coverage-DoKEW branch January 9, 2026 03:03
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.

2 participants