Skip to content

Add unit tests for spam_checker.py heuristics #11

Description

@SaharPak

Context

The spam detection logic in src/services/spam_checker.py has no tests yet. This is a great first contribution — no Telegram API knowledge needed.

What to do

  1. Create tests/test_spam_checker.py
  2. Write tests for the heuristic scoring (not the AI parts):
    • User with no username → score increases
    • User with short name → score increases
    • Bot user → high score
    • Normal user → approved
    • Message with spam patterns → detected
    • Clean message → passes

Tips

  • Mock the AI functions (they call external APIs)
  • Use pytest and pytest-asyncio
  • Run with: pytest tests/

Acceptance Criteria

  • At least 8 test cases covering main paths
  • Tests pass with pytest
  • No external API calls in tests (mock AI)

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersphase-1Phase 1: Join approval & moderation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions