Context
PR #623 added helper-level unit tests for dispatch_line_reply() covering the 6 dispatch decision scenarios. During review, 擺渡法師 identified a gap: there is no test covering the full gateway wiring path.
This is a follow-up from the PR #623 review discussion.
What is missing
A test that exercises the actual gateway wiring:
- Webhook writes cache —
line_webhook handler receives a LINE event with replyToken and inserts event_id → (replyToken, timestamp) into reply_token_cache
- OAB reply reads cache — A WebSocket reply with
reply_to = event_id hits the cache and retrieves the correct replyToken
- Correct API branch — Verify the reply actually goes through Reply API (with the cached token) or Push API (on cache miss)
- End-to-end payload correctness — Verify
Authorization header, replyToken/to, and message body reach the LINE API
Why this matters
The current unit tests call dispatch_line_reply() directly with a pre-populated cache. If someone breaks the event_id ↔ reply_to wiring between line_webhook and the WebSocket reply handler, the existing 6 tests would still pass green.
Suggested approach
- Start an axum test server with the full router
- POST a LINE webhook payload → verify cache is populated
- Connect a WebSocket client, receive the event, send a reply → verify the correct LINE API is called
- Use
wiremock for the LINE API mock
Related
Context
PR #623 added helper-level unit tests for
dispatch_line_reply()covering the 6 dispatch decision scenarios. During review, 擺渡法師 identified a gap: there is no test covering the full gateway wiring path.This is a follow-up from the PR #623 review discussion.
What is missing
A test that exercises the actual gateway wiring:
line_webhookhandler receives a LINE event withreplyTokenand insertsevent_id → (replyToken, timestamp)intoreply_token_cachereply_to = event_idhits the cache and retrieves the correctreplyTokenAuthorizationheader,replyToken/to, and message body reach the LINE APIWhy this matters
The current unit tests call
dispatch_line_reply()directly with a pre-populated cache. If someone breaks theevent_id↔reply_towiring betweenline_webhookand the WebSocket reply handler, the existing 6 tests would still pass green.Suggested approach
wiremockfor the LINE API mockRelated