Skip to content

Conversation

@fank
Copy link
Member

@fank fank commented Jan 30, 2026

Summary

  • Add unit tests for previously untested components in internal/server/
  • Improve overall project test coverage from ~23% to 31.6%
  • Improve server package coverage to 65%

New Test Files

File Lines Coverage
marker_test.go ~350 Tests for NewRepoMarker, scanColor, Get, paintSVG, paintPNG, scanDir, max
ammo_test.go ~100 Tests for NewRepoAmmo, GetPath
setting_test.go ~200 Tests for NewSetting (config files, env vars, defaults, secret validation)
integration_test.go +180 Added marker/ammo HTTP integration tests

Key Coverage Improvements

marker.go:

  • NewRepoMarker: 100%
  • scanColor: 100%
  • Get: 93.3%
  • paintPNG: 92%
  • paintSVG: 83.3%
  • scanDir: 93.3%

ammo.go:

  • NewRepoAmmo: 100%
  • GetPath: 100%

setting.go:

  • NewSetting: 94.6%

handler.go (key endpoints):

  • GetMarker: 90.9%
  • GetAmmo: 91.7%

Test plan

  • All existing tests pass
  • New tests pass
  • Coverage verified with go test -cover

Add unit tests for previously untested components:
- marker_test.go: NewRepoMarker, scanColor, Get, paintSVG, paintPNG, scanDir
- ammo_test.go: NewRepoAmmo, GetPath
- setting_test.go: NewSetting with config files, env vars, defaults

Extend integration_test.go with HTTP tests for marker and ammo serving.

Coverage improvements:
- internal/server: 65% (up from ~60%)
- Overall project: 31.6% (up from ~23%)
@github-actions
Copy link

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/OCAP2/web/internal/server 64.98% (+38.11%) 🌟

Coverage by file

Changed unit test files

  • github.com/OCAP2/web/internal/server/ammo_test.go
  • github.com/OCAP2/web/internal/server/integration_test.go
  • github.com/OCAP2/web/internal/server/marker_test.go
  • github.com/OCAP2/web/internal/server/setting_test.go

@fank fank merged commit 3f4129f into main Jan 30, 2026
4 checks passed
@fank fank deleted the test/improve-server-coverage branch January 30, 2026 14:17
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