Files
nanoclaw/.claude/skills/add-pdf-reader/modify/src/channels/whatsapp.test.ts.intent.md
glifocat 0b260ece57 feat(skills): add pdf-reader skill (#772)
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.
2026-03-06 18:47:12 +02:00

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: fs mock to include writeFileSync as 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