Skip to content

test: add unit tests for factories and UserEntity to improve patch coverage / FactoryとUserEntityのユニットテストを追加してパッチカバレッジを改善#498

Merged
zigzagdev merged 4 commits into
feat/user_registerfrom
feat/user_register-improve_coverage
Jun 28, 2026
Merged

test: add unit tests for factories and UserEntity to improve patch coverage / FactoryとUserEntityのユニットテストを追加してパッチカバレッジを改善#498
zigzagdev merged 4 commits into
feat/user_registerfrom
feat/user_register-improve_coverage

Conversation

@zigzagdev

Copy link
Copy Markdown
Owner

Motivation / 目的

After PR #497, Codecov still reported 69.89% patch coverage (target 85%). Investigation showed the following source files had no unit tests covering them.

PR #497 マージ後も Codecov のパッチカバレッジが 69.89%(目標 85%)のままでした。以下のソースファイルにユニットテストが不足していることが原因と判明しました。

What I have done / 実施内容

  • SubscriptionFactoryTest: covers build() with null/string/DateTimeImmutable expires_at, string/DateTimeImmutable now (5 tests)
  • UserEntityFactoryTest: covers build() creating correct UserEntity with Free and Premium subscriptions (2 tests)
  • UserEntityTest: covers all getters including getFullName() (7 tests)
  • UserViewModelFactoryTest: covers build() returning UserViewModel instance (1 test)

Test Results / テスト結果

All new tests pass. Previous 26 tests + 15 new = 41 unit tests total.

Closes part of #400

@zigzagdev zigzagdev self-assigned this Jun 28, 2026
@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.40%. Comparing base (ccc5e72) to head (a77ced6).
⚠️ Report is 1 commits behind head on feat/user_register.

Additional details and impacted files

Impacted file tree graph

@@                  Coverage Diff                  @@
##             feat/user_register     #498   +/-   ##
=====================================================
  Coverage                 55.40%   55.40%           
  Complexity                 1409     1409           
=====================================================
  Files                       102      102           
  Lines                      7039     7039           
=====================================================
  Hits                       3900     3900           
  Misses                     3139     3139           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zigzagdev zigzagdev left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

coverage ok

@zigzagdev zigzagdev merged commit 2f6a66e into feat/user_register Jun 28, 2026
27 checks passed
@zigzagdev zigzagdev deleted the feat/user_register-improve_coverage branch June 28, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant