Repository navigation
refactor(test): reuse the Zalo mock-call assertion helper - #139294
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 2:54 PM ET / 18:54 UTC. ClawSweeper reviewWhat this changesThe PR replaces Zalo tests’ local mock-call guard with the existing shared assertion helper, preserving coverage without changing production behavior. Merge readiness✅ Ready for maintainer review No actionable findings. This useful, maintainer-requested cleanup remains absent from current main and preserves the existing assertions. Priority: P3 Review scores
Verification
How this fits togetherThe Zalo plugin translates messaging operations into HTTP requests. Its API tests inspect recorded fetch calls to check request construction, deadlines, and rejection behavior. flowchart LR
A[Test scenarios] --> B[Zalo API client]
B --> C[Recorded fetch calls]
C --> D[Shared presence assertion]
D --> E[Request and abort assertions]
E --> F[Test result]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests -7. Total -7 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Use the existing shared assertion while retaining request-specific guards, all behavioral coverage, and main’s independent timer cleanup. Do we have a high-confidence way to reproduce the issue? Not applicable: this refactor reports duplicated test support, not a runtime bug; source inspection confirms the duplication. Is this the best way to solve the issue? Yes. Direct reuse preserves tuple typing and missing-call failures without another adapter; keeping the local helper would retain unnecessary duplication. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d4d766d39fb2. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
The Zalo API tests carry a local adapter for requiring the first mock fetch call, duplicating the existing SDK assertion helper. This maintainer-requested cleanup consolidates that assertion without removing coverage.
Why This Change Was Made
Use
expectDefined(fetcher.mock.calls[0], label)at the five call sites and delete the local adapter. The generic SDK helper preserves the typed argument tuple and fails when the call is missing. Request-init and abort-signal guards remain explicit at their callers.User Impact
No user-visible behavior changes. Production code is unchanged; tests are +6/-13 lines. All 20 API cases and 35 expectations remain, including request methods, timeouts, body handling, photo URL validation, SSRF rejection and cleanup.
Evidence
These local checks used base
3d129595202d65d60a363dec093f20861fb2bcf3. Current main independently removes fake timer handles in three of these tests; that change must remain intact at landing and is not included in this cleanup's LOC count. Fresh hosted CI must validate the merged candidate before landing. No live external Zalo service behavior is claimed or changed.