Skip to content

Add unit tests for User, UserPeer, UserHistory, and UserHistoryPeer#8

Draft
rsharrott wants to merge 1 commit intomasterfrom
claude/analyze-test-coverage-1V5Qi
Draft

Add unit tests for User, UserPeer, UserHistory, and UserHistoryPeer#8
rsharrott wants to merge 1 commit intomasterfrom
claude/analyze-test-coverage-1V5Qi

Conversation

@rsharrott
Copy link
Copy Markdown
Contributor

$(cat <<'EOF'

Summary

  • Adds UserTest covering User model init, insert, update, default-user delete protection, cascade-delete of history rows, and UserPeer retrieval methods (allUsers, userWithUserId:, unknown-ID handling)
  • Adds UserHistoryTest covering UserHistory NSCoding round-trip, saveToUserId: persistence, UserHistoryPeer history retrieval, the full _nextAfterLevel:gotItRight: level-progression truth table, and DB-backed recordCorrectForCard:, recordWrongForCard:, and buryCard: behaviour

Test plan

  • Build the jFlash test target — all new tests should compile without warnings
  • Build the cFlash test target — same files are included via the shared Tests/ folder; conditional-compilation constants (CURRENT_CARD_TEST_DATABASE, kLWEFavoriteTagName tag ID) flip automatically
  • Run jFlash tests: UserTest (10 cases) and UserHistoryTest (12 cases) should all pass
  • Confirm testDeleteDefaultUserFails returns NO and a non-nil NSError
  • Confirm testNSCodingRoundTrip passes without a DB connection (pure in-memory test)
  • Confirm testRecordCorrect/Wrong/BuryCard pass with the cards DB attached in setUp

https://claude.ai/code/session_01A6LuMixdzhqX3TdVUqZaxX
EOF
)


Generated by Claude Code

Covers the previously untested model layer for user data and study history:
- UserTest: init defaults, save-insert, save-update, delete protection for
  default user, cascade delete of history, and UserPeer retrieval methods
- UserHistoryTest: NSCoding round-trip, saveToUserId persistence,
  userHistoriesForUserId retrieval, _nextAfterLevel level-progression
  logic for all edge cases, and DB-backed recordCorrect/recordWrong/buryCard

https://claude.ai/code/session_01A6LuMixdzhqX3TdVUqZaxX
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