Thanks @glifocat! Clean skill package — good docs, solid tests, nice intent files. Pushed a small fix for path traversal on the PDF filename before merging.
967 B
967 B
Intent: src/channels/whatsapp.test.ts modifications
What changed
Added mocks for downloadMediaMessage and normalizeMessageContent, and test cases for PDF attachment handling.
Key sections
Mocks (top of file)
- Modified: config mock to export
GROUPS_DIR: '/tmp/test-groups' - Modified:
fsmock to includewriteFileSyncas vi.fn() - Modified: Baileys mock to export
downloadMediaMessage,normalizeMessageContent - Modified: fake socket factory to include
updateMediaMessage
Test cases (inside "message handling" describe block)
- "downloads and injects PDF attachment path" — verifies PDF download, save, and content replacement
- "handles PDF download failure gracefully" — verifies error handling (message skipped since content remains empty)
Invariants (must-keep)
- All existing test cases unchanged
- All existing mocks unchanged (only additive changes)
- All existing test helpers unchanged
- All describe blocks preserved