Add Discord-native hybrid front-end for Jarvis (bot + bridge)
Some checks failed
Release / semantic-release (push) Successful in 59s
tests / Unit tests (Linux, Python 3.11) (push) Successful in 13m45s
Release / build-linux (push) Failing after 7m47s
Release / build-windows (push) Has been cancelled
Release / build-macos (arm64, macos-latest) (push) Has been cancelled
Release / build-macos (x64, macos-15-intel) (push) Has been cancelled
Release / release-main (push) Has been cancelled
Release / release-develop (push) Has been cancelled
Some checks failed
Release / semantic-release (push) Successful in 59s
tests / Unit tests (Linux, Python 3.11) (push) Successful in 13m45s
Release / build-linux (push) Failing after 7m47s
Release / build-windows (push) Has been cancelled
Release / build-macos (arm64, macos-latest) (push) Has been cancelled
Release / build-macos (x64, macos-15-intel) (push) Has been cancelled
Release / release-main (push) Has been cancelled
Release / release-develop (push) Has been cancelled
Transform isair/jarvis into a Discord-controlled voice assistant running on the Ubuntu VNC desktop, keeping the mature ~39k-line Python brain intact. - bot/ (Node + bun, discord.js): /자비스 slash commands (ephemeral), voice channel join + voice receive/playback, pluggable VNC screen broadcast (selfbot live / noVNC / screenshot) - bridge/ (Python, Flask): wraps jarvis STT + run_reply_engine + Piper TTS behind a thin localhost HTTP API - .env.example, scripts/ (start_bridge/start_bot/dev), README rewrite, docs/language-comparison.md and docs/vnc-xfce-setup.md Language decision: hybrid (Python brain + Node/bun Discord layer) because Discord blocks bot video; native screen broadcast only works via a Node selfbot library.
This commit is contained in:
74
tests/tools/builtin/nutrition/test_fetch_meals.py
Normal file
74
tests/tools/builtin/nutrition/test_fetch_meals.py
Normal file
@@ -0,0 +1,74 @@
|
||||
"""Tests for fetch meals tool."""
|
||||
|
||||
import pytest
|
||||
from unittest.mock import Mock
|
||||
from datetime import datetime, timezone, timedelta
|
||||
|
||||
from src.jarvis.tools.builtin.nutrition.fetch_meals import FetchMealsTool
|
||||
from src.jarvis.tools.base import ToolContext
|
||||
from src.jarvis.tools.types import ToolExecutionResult
|
||||
|
||||
|
||||
class TestFetchMealsTool:
|
||||
"""Test fetch meals tool functionality."""
|
||||
|
||||
def setup_method(self):
|
||||
"""Set up test fixtures."""
|
||||
self.tool = FetchMealsTool()
|
||||
self.context = Mock(spec=ToolContext)
|
||||
self.context.user_print = Mock()
|
||||
self.context.db = Mock()
|
||||
|
||||
def test_tool_properties(self):
|
||||
"""Test tool metadata properties."""
|
||||
assert self.tool.name == "fetchMeals"
|
||||
assert "meals" in self.tool.description.lower()
|
||||
assert self.tool.inputSchema["type"] == "object"
|
||||
assert self.tool.inputSchema["required"] == []
|
||||
|
||||
def test_run_success(self):
|
||||
"""Test successful meal fetching."""
|
||||
# Mock database response
|
||||
mock_meals = [
|
||||
{
|
||||
"description": "Breakfast",
|
||||
"calories_kcal": 300,
|
||||
"protein_g": 15,
|
||||
"carbs_g": 30,
|
||||
"fat_g": 10
|
||||
},
|
||||
{
|
||||
"description": "Lunch",
|
||||
"calories_kcal": 500,
|
||||
"protein_g": 25,
|
||||
"carbs_g": 45,
|
||||
"fat_g": 20
|
||||
}
|
||||
]
|
||||
self.context.db.get_meals_between.return_value = mock_meals
|
||||
|
||||
args = {
|
||||
"since_utc": "2025-01-01T00:00:00Z",
|
||||
"until_utc": "2025-01-01T23:59:59Z"
|
||||
}
|
||||
|
||||
result = self.tool.run(args, self.context)
|
||||
|
||||
assert isinstance(result, ToolExecutionResult)
|
||||
assert result.success is True
|
||||
assert "Meals: 2" in result.reply_text
|
||||
assert "Total ~800 kcal" in result.reply_text
|
||||
assert "Breakfast" in result.reply_text
|
||||
assert "Lunch" in result.reply_text
|
||||
|
||||
def test_run_no_args(self):
|
||||
"""Test meal fetching with no time range (defaults to last 24h)."""
|
||||
self.context.db.get_meals_between.return_value = []
|
||||
|
||||
result = self.tool.run(None, self.context)
|
||||
|
||||
assert isinstance(result, ToolExecutionResult)
|
||||
assert result.success is True
|
||||
assert "Meals: 0" in result.reply_text
|
||||
# Should have called db with some time range
|
||||
self.context.db.get_meals_between.assert_called_once()
|
||||
Reference in New Issue
Block a user