test(T3): add contract test suites for Account/Mailbox/Email repositories #43

Merged
guettlibot merged 1 commits from task/t3-repository-contract-tests into main 2026-05-14 08:20:33 +00:00
guettlibot commented 2026-05-14 08:16:25 +00:00 (Migrated from codeberg.org)

Implements T3 from the improvement plan.

The three repository interfaces had no shared contract test suite —
concrete impls could silently diverge from the interface semantics.

Three new abstract contract classes verify observable-state invariants:

  • AccountRepositoryContract — 9 tests (addAccount, getAccount, updateAccount, removeAccount, getPassword)
  • MailboxRepositoryContract — 6 tests (observeMailboxes ordering/filtering, findMailboxByRole, clearForResync)
  • EmailRepositoryContract — 8 tests (observeEmails ordering/filtering, getEmail, setFlag, observeThreads)

Each concrete impl (*Impl) is run against the suite via a thin subclass.
Future fakes or alternative implementations can be verified by subclassing
the same contract class without duplicating test logic.

Network-dependent methods (syncEmails, syncMailboxes, etc.) are excluded
from the contract — they are covered by the existing impl-specific tests.

Closes #19 (T3)

Implements T3 from the improvement plan. The three repository interfaces had no shared contract test suite — concrete impls could silently diverge from the interface semantics. Three new abstract contract classes verify observable-state invariants: - `AccountRepositoryContract` — 9 tests (addAccount, getAccount, updateAccount, removeAccount, getPassword) - `MailboxRepositoryContract` — 6 tests (observeMailboxes ordering/filtering, findMailboxByRole, clearForResync) - `EmailRepositoryContract` — 8 tests (observeEmails ordering/filtering, getEmail, setFlag, observeThreads) Each concrete impl (`*Impl`) is run against the suite via a thin subclass. Future fakes or alternative implementations can be verified by subclassing the same contract class without duplicating test logic. Network-dependent methods (syncEmails, syncMailboxes, etc.) are excluded from the contract — they are covered by the existing impl-specific tests. Closes #19 (T3)
Sign in to join this conversation.