Skip to content

Add unit test coverage for core modules#473

Open
TimElschner wants to merge 52 commits intoFinsys:mainfrom
TimElschner:tests/add-unit-test-coverage
Open

Add unit test coverage for core modules#473
TimElschner wants to merge 52 commits intoFinsys:mainfrom
TimElschner:tests/add-unit-test-coverage

Conversation

@TimElschner
Copy link
Copy Markdown
Contributor

@TimElschner TimElschner commented Feb 5, 2026

Summary

  • Adds 110+ unit tests across 7 new test files covering previously untested core modules
  • Exports maskSecrets (git.ts) and escapeTelegramMarkdown (notifications.ts) for direct testability
  • All unit tests run without a Dockhand instance — zero external dependencies

Test Files

File Tests Covers
tests/utils.test.ts 37 compareVersions, shouldShowWhatsNew, computeAuditDiff, formatFieldName, ipToNumber
tests/encryption.test.ts 24 AES-256-GCM encrypt/decrypt roundtrips, isEncrypted, generateKey
tests/git-utils.test.ts 23 maskSecrets, parseEnvFileContent
tests/notifications-utils.test.ts 9 escapeTelegramMarkdown
tests/auth.test.ts 13 Rate limiting (5-attempt lockout), hashPassword/verifyPassword
tests/authorize-helpers.test.ts 4 unauthorized(), forbidden(), enterpriseRequired()
tests/api-smoke.test.ts 10 REST API endpoint smoke tests (requires running instance)

Source Changes (minimal)

  • src/lib/server/git.ts: function maskSecretsexport function maskSecrets
  • src/lib/server/notifications.ts: function escapeTelegramMarkdownexport function escapeTelegramMarkdown

Test plan

  • bun test tests/utils.test.ts — 37 pass
  • bun test tests/encryption.test.ts — 24 pass
  • bun test tests/git-utils.test.ts — 23 pass
  • bun test tests/notifications-utils.test.ts — 9 pass
  • bun test tests/auth.test.ts — 13 pass
  • bun test tests/authorize-helpers.test.ts — 4 pass
  • bun test tests/api-smoke.test.ts — requires running Dockhand instance

🤖 Generated with Claude Code

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
5 out of 6 committers have signed the CLA.

✅ sieren
✅ FlintyLemming
✅ shamoon
✅ TimElschner
✅ vikte
❌ jotka
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

9 participants