Skip to content

test(config): add unit tests for provider module#301

Merged
zbigniewsobiecki merged 1 commit intodevfrom
test/config-provider-unit-tests
Feb 16, 2026
Merged

test(config): add unit tests for provider module#301
zbigniewsobiecki merged 1 commit intodevfrom
test/config-provider-unit-tests

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Feb 16, 2026

Summary

Added comprehensive unit tests for the config provider module (src/config/provider.ts) to ensure reliable configuration loading logic.

Card: https://trello.com/c/8AqzAXyf/3-as-a-developer-i-want-unit-tests-for-config-provider-module-so-that-configuration-loading-logic-is-reliable

What was implemented

  • Test loadConfig() - Verifies caching behavior and DB repository integration
  • Test findProjectByBoardId/Repo/JiraKey - All three lookup functions tested with cache hits and misses
  • Test getProjectSecret() - Verifies resolution order (project override → org default), throws on missing secret
  • Test getProjectSecretOrNull() - Returns null instead of throwing when secret not found
  • Test getProjectSecrets() - Tests bulk credential resolution with caching
  • Test getAgentCredential() - Verifies agent-specific credential resolution with proper fallback chain
  • Test invalidateConfigCache() - Ensures cache is properly cleared
  • 35 test cases covering all functions and edge cases
  • 100% code coverage for src/config/provider.ts

Test patterns

  • Followed existing patterns from tests/unit/config/configCache.test.ts
  • Mocked DB repositories (configRepository, credentialsRepository) and configCache
  • Verified cache hits prevent DB calls
  • Verified cache misses trigger DB calls and cache updates
  • Tested error handling (missing secrets, undefined projects)
  • Tested org ID caching and resolution
  • Tested agent-specific credential resolution

Testing

  • ✅ All 35 new tests passing
  • ✅ All existing tests passing (full test suite)
  • ✅ 100% coverage for provider.ts
  • ✅ Lint checks passing
  • ✅ Type checks passing

🤖 Generated with Claude Code

@zbigniewsobiecki zbigniewsobiecki merged commit fe537b7 into dev Feb 16, 2026
4 checks passed
@zbigniewsobiecki zbigniewsobiecki deleted the test/config-provider-unit-tests branch March 16, 2026 16:43
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