Skip to content

test: improve coverage for settings, funfacts types, and context enricher - #23

Merged
engels74 merged 1 commit into
mainfrom
test/coverage-boost
Jan 3, 2026
Merged

test: improve coverage for settings, funfacts types, and context enricher#23
engels74 merged 1 commit into
mainfrom
test/coverage-boost

Conversation

@engels74

@engels74 engels74 commented Jan 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add tests for previously untested functions in settings.service.ts (UI theme, Plex config, CSRF config)
  • Add tests for InsufficientStatsError class in funfacts/types.ts
  • Add tests for isContextEnriched and ensureEnrichedContext in context-enricher.ts

Coverage Improvements

File Before After
context-enricher.ts 50% funcs, 77% lines 100% both
funfacts/types.ts 67% funcs, 89% lines 100% both
settings.service.ts (targeted lines) Lines 103-107, 111, 412-426, 430-431, 475-480 uncovered All covered

Test plan

  • All 83 new/modified tests pass
  • No regressions in existing tests

@augmentcode

augmentcode Bot commented Jan 3, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: This PR improves unit test coverage across admin settings helpers and fun-facts utilities, without changing production behavior.

Changes:

  • Extended tests/unit/admin/settings.service.test.ts to cover UI theme persistence (getUITheme/setUITheme), Plex configuration completeness (isPlexConfigured), and CSRF helpers (getCsrfConfigWithSource, getCsrfOrigin, and warning dismissal/reset helpers).
  • Added tests/unit/funfacts/context-enricher.test.ts to validate trivia enrichment math, isContextEnriched, and ensureEnrichedContext idempotence/non-mutation behavior.
  • Added tests/unit/funfacts/types.test.ts to validate fun-facts error types (FunFactsError, AIGenerationError, InsufficientStatsError) including message/code/status/cause semantics.

Technical Notes:

  • Tests run against the in-memory SQLite DB created in tests/setup.ts and rely on mocked SvelteKit $env modules for deterministic config behavior.
  • Coverage improvements primarily target previously untested branches around config resolution (default vs DB vs env) and enrichment/type guards.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

…cher

Add tests covering previously untested functions:
- settings.service: getUITheme, setUITheme, isPlexConfigured, CSRF config functions
- funfacts/types: InsufficientStatsError class
- funfacts/context-enricher: isContextEnriched, ensureEnrichedContext
@engels74
engels74 force-pushed the test/coverage-boost branch from 0bf22b8 to a574f0d Compare January 3, 2026 12:23
@engels74

engels74 commented Jan 3, 2026

Copy link
Copy Markdown
Collaborator Author

augment review

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

@engels74
engels74 merged commit 04aec5f into main Jan 3, 2026
1 check passed
@engels74
engels74 deleted the test/coverage-boost branch January 3, 2026 12:49
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.

1 participant