Files
OpenJarvis/tests/cli/test_digest_cmd.py
T
Jon Saad-FalconandClaude Opus 4.6 d73014d6bb feat: Morning Digest pipeline + unified OAuth + Apple connectors
Full morning digest system:
- MorningDigestAgent, DigestStore, digest_collect tool, TTS backends
- Connectors: Oura, Strava, Spotify, Google Tasks, Apple Health, Apple Music
- CLI `jarvis digest` command + FastAPI /api/digest endpoints
- Cartesia, Kokoro, OpenAI TTS backends with persona prompts

Unified OAuth setup across all surfaces:
- Generic OAuthProvider registry for Google, Strava, Spotify
- CLI auto-opens browser + catches callback (no more paste-code)
- Server /oauth/start + /oauth/callback endpoints for desktop/browser
- Frontend OAuthPanel with popup + polling

Apple connectors:
- Apple Health reads from HealthKit DB or iPhone export XML
- Apple Music queries Music.app via AppleScript

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 11:05:35 -07:00

56 lines
1.5 KiB
Python

"""Tests for `jarvis digest` CLI command."""
from __future__ import annotations
from datetime import datetime
from pathlib import Path
import pytest
from click.testing import CliRunner
from openjarvis.agents.digest_store import DigestArtifact, DigestStore
def test_digest_command_exists():
"""The digest command is registered on the CLI."""
from openjarvis.cli import cli
runner = CliRunner()
result = runner.invoke(cli, ["digest", "--help"])
assert result.exit_code == 0
assert "digest" in result.output.lower()
def test_digest_displays_cached(tmp_path):
from openjarvis.cli import cli
db_path = str(tmp_path / "digest.db")
store = DigestStore(db_path=db_path)
store.save(
DigestArtifact(
text="# Messages\nYou have 3 emails.\n# Calendar\n2 meetings today.",
audio_path=Path("/nonexistent/audio.mp3"),
sections={},
sources_used=["gmail"],
generated_at=datetime.now(),
model_used="test",
voice_used="jarvis",
)
)
store.close()
runner = CliRunner()
result = runner.invoke(cli, ["digest", "--text-only", "--db-path", db_path])
assert result.exit_code == 0
assert "3 emails" in result.output
def test_digest_no_cache(tmp_path):
from openjarvis.cli import cli
db_path = str(tmp_path / "empty.db")
runner = CliRunner()
result = runner.invoke(cli, ["digest", "--db-path", db_path])
assert result.exit_code == 0
assert "No digest for today" in result.output