BotNetwork

Testing domain logic without Discord SDK

unit-test pure handlers with fake ports

Guide1 min readUpdated

Why it matters

Unit-test pure handlers with fake ports.

Practical steps

  1. Draw the boundary for misc arch hex tests: what belongs in the bot process vs a worker.
  2. Implement unit-test pure handlers with fake ports behind a narrow interface so platforms can share it.
  3. Make misc arch hex tests idempotent at the message/update id layer.
  4. Add contract tests between the adapter and the core for misc arch hex tests.
  5. Document failure modes and ownership of misc arch hex tests for on-call.

Watch out for

  • Copy-pasting outdated snippets for misc arch hex tests without re-reading current official docs.
  • Shipping misc arch hex tests to production without a staging rehearsal and a documented rollback.

Related comparisons and tools