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.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
# 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
|
||||
Reference in New Issue
Block a user