Context
PR #608 introduced the hybrid LINE Reply/Push strategy in gateway/src/main.rs. The gateway currently has zero tests. The new stateful cache and dispatch logic should have unit test coverage.
What to test
Unit tests (no HTTP mocking required)
Integration tests (requires HTTP mock, follow-up)
Related
Context
PR #608 introduced the hybrid LINE Reply/Push strategy in
gateway/src/main.rs. The gateway currently has zero tests. The new stateful cache and dispatch logic should have unit test coverage.What to test
Unit tests (no HTTP mocking required)
REPLY_TOKEN_CACHE_MAX(10k), verify the 10,001st insert is rejected with awarn!and does not panicREPLY_TOKEN_TTL_SECSand verify it is treated as expiredtoken_unusablepredicate — extract the 400-body string matching into a helper function and test:"Invalid reply token"→token_unusable = true(fall back to Push)"The reply token has expired"→token_unusable = true"Internal server error"(5xx) →token_unusable = false(no fallback, duplicate safety)token_unusable = falseIntegration tests (requires HTTP mock, follow-up)
reply_toempty → direct Push (no cache lookup attempted)Related
feat(gateway): implement hybrid LINE reply/push strategyfeat(core): propagate event_id to GatewayReply.reply_to