Skip to content

[Tests] Add unit tests for issues #102, #103, #104, #105#109

Merged
fboucher merged 5 commits intov-nextfrom
squad/103-ai-settings-provider-fallback
Apr 1, 2026
Merged

[Tests] Add unit tests for issues #102, #103, #104, #105#109
fboucher merged 5 commits intov-nextfrom
squad/103-ai-settings-provider-fallback

Conversation

@fboucher
Copy link
Copy Markdown
Owner

@fboucher fboucher commented Apr 1, 2026

Summary

Closes #102, #103, #104, #105

All 227 tests pass (196 Api.Tests + 31 AIServices.Tests).

Changes

#102 — SummaryEndpoints tests (10 new tests)

  • Happy-path tests for all 4 endpoints: GetSummaries, SaveSummary, GetReadingNotes, SaveReadingNotesMarkdown
  • Not-found / empty response tests for GetSummaries and GetReadingNotes
  • Validation-error test for SaveSummary (missing PartitionKey, RowKey, Title)
  • BadRequest test for SaveReadingNotesMarkdown with empty body

#103 — AISettingsProvider fallback chain (13 new tests)

  • DB happy path (with/without custom BaseUrl/ModelName)
  • DB key absent → falls back to AppSettings:AiApiKey config
  • DB exception thrown → falls back to config
  • AppSettings:REKA_API_KEY config key fallback
  • Env var REKA_API_KEY fallback
  • All sources absent → throws InvalidOperationException

#104 — SettingEndpoints edge cases (3 new tests)

  • GetSettings returns default prompts with required placeholders ({topic}, {content})
  • GetSettings masks AiApiKey as "********" (security check)
  • SaveSettings with empty PartitionKey returns 400

#105 — PostEndpoints edge cases (5 acceptance criteria verified + 5 pre-existing failures fixed)

  • GET non-existent ID → 404
  • DELETE non-existent ID → graceful handling
  • Unread posts list when all read → empty
  • Read posts list when none read → empty
  • Duplicate post save behavior
  • Fixed 5 pre-existing test failures caused by shared Azurite state

Copy link
Copy Markdown
Owner Author

@fboucher fboucher left a comment

Choose a reason for hiding this comment

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

✅ Code Review — APPROVED

Reviewed by: Livingston (Code Review Specialist)
All 26 acceptance criteria from issues #102, #103, #104, #105 are fully covered.

Coverage Summary:

  • Issue #102 (SummaryEndpoints): ✅ 8/8 ACs covered
  • Issue #103 (AISettingsProvider): ✅ 8/8 ACs covered
  • Issue #104 (SettingEndpoints): ✅ 4/4 ACs covered
  • Issue #105 (PostEndpoints): ✅ 6/6 ACs covered

Test Quality:

✅ All 227 tests pass (196 Api.Tests + 31 AIServices.Tests)
✅ Proper mocking with IDataStorageService and IConfiguration
✅ Edge cases thoroughly covered (null, empty, whitespace, non-existent)
✅ Follows xUnit + FluentAssertions conventions
✅ Pre-existing test failures fixed

Highlights:

  • AISettingsProvider fallback chain: All 5 fallback paths tested (DB → AiApiKey config → REKA_API_KEY config → env var → throw)
  • SummaryEndpoints: Happy paths + validation + not-found scenarios
  • SettingEndpoints: Default prompts verified with {topic}/{content} placeholders + API key masking security test
  • PostEndpoints: Comprehensive edge cases including empty list filtering and duplicate post behavior

Verdict:

APPROVE — Ready to merge. No gaps found.

*Excellent work by Linusecho BEGIN___COMMAND_OUTPUT_MARKER ; PS1= ; PS2= ; unset HISTFILE ; EC=0 ; echo ___BEGIN___COMMAND_DONE_MARKER___0 ; } 🎯

Full review document: .squad/decisions/inbox/livingston-pr109-review.md

fboucher and others added 5 commits April 1, 2026 07:25
- GET /api/posts/{id} non-existent ID → 404 (GetPost_WhenPostDoesNotExist_ReturnsNotFound)
- DELETE /api/posts/{id} non-existent ID → 404 (DeletePost_WhenPostDoesNotExist_ReturnsNotFound)
- GET /api/posts/ all-read scenario → read posts excluded from unread list
- GET /api/posts/read no-read scenario → returns empty list
- POST /api/posts/ duplicate RowKey → overwrites existing (upsert behavior)
- Fixed 5 pre-existing test failures: shared storage assertions and empty-ID routing edge cases

Co-authored-by: Copilot <[email protected]>
@fboucher fboucher force-pushed the squad/103-ai-settings-provider-fallback branch from f7636a1 to dbf0b63 Compare April 1, 2026 11:25
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

Code Coverage

Package Line Rate Branch Rate Health
NoteBookmark.AIServices 97% 64%
NoteBookmark.Domain 5% 9%
NoteBookmark.Api 91% 80%
NoteBookmark.ServiceDefaults 96% 75%
NoteBookmark.Domain 83% 72%
NoteBookmark.AIServices 97% 64%
NoteBookmark.Domain 5% 9%
NoteBookmark.Api 91% 80%
NoteBookmark.ServiceDefaults 96% 75%
NoteBookmark.Domain 83% 72%
Summary 63% (1582 / 2178) 49% (360 / 568)

@fboucher fboucher merged commit 343e791 into v-next Apr 1, 2026
3 checks passed
@fboucher fboucher deleted the squad/103-ai-settings-provider-fallback branch April 1, 2026 11:47
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.

[Tests] SummaryEndpoints — add tests for all 4 methods

1 participant