Skip to content

Add comprehensive unit test suite (282 tests)#2

Merged
thomasluizon merged 1 commit into
mainfrom
chore/add-unit-tests
Mar 20, 2026
Merged

Add comprehensive unit test suite (282 tests)#2
thomasluizon merged 1 commit into
mainfrom
chore/add-unit-tests

Conversation

@thomasluizon

Copy link
Copy Markdown
Owner

Summary

  • Add 3 new test projects: Orbit.Domain.Tests (99), Orbit.Application.Tests (160), Orbit.Infrastructure.Tests (23)
  • 282 unit tests covering domain entities, CQRS handlers, validators, services, and infrastructure
  • Stack: xUnit + FluentAssertions + NSubstitute
  • All tests deterministic -- no real DB, API, or AI calls

Coverage highlights

  • Domain (99): Entity equality, Result pattern, User/Habit/Tag/UserFact factories, logging toggle, DueDate advancement, trial/pro access, prompt injection detection
  • Application (160): All FluentValidation validators, HabitScheduleService (15 schedule scenarios), PayGateService (free/pro limits), ValidationBehavior pipeline, 60 command handler tests (CRUD, auth, bulk ops, circular reference detection)
  • Infrastructure (23): JWT generation/claims, SystemPromptBuilder assembly, image validation (size/extension/magic bytes), Result-to-ActionResult mapping

Test plan

  • dotnet test tests/Orbit.Domain.Tests -- 99 passed
  • dotnet test tests/Orbit.Application.Tests -- 160 passed
  • dotnet test tests/Orbit.Infrastructure.Tests -- 23 passed

Generated with Claude Code

Three new test projects covering Domain, Application, and Infrastructure layers:

- Orbit.Domain.Tests (99 tests): Entity equality, Result pattern, User/Habit/Tag/UserFact/PushSubscription/Notification factories, domain logic (logging, scheduling, trial/pro access, prompt injection detection)
- Orbit.Application.Tests (160 tests): Validators (Create/Update/Log/Bulk/Schedule/UserFact/Timezone), HabitScheduleService, PayGateService, ValidationBehavior pipeline, CacheInvalidationHelper, ResultExtensions, all command handlers (Habits, Tags, UserFacts, Profile, Auth)
- Orbit.Infrastructure.Tests (23 tests): JwtTokenService, SystemPromptBuilder, ImageValidationService, ResultActionResultExtensions, HttpContextExtensions

Stack: xUnit + FluentAssertions + NSubstitute

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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