mirror of
https://github.com/elisiariocouto/leggen.git
synced 2025-12-13 13:42:19 +00:00
fix: Resolve all lint warnings and type errors across frontend and backend.
Frontend: - Memoize pagination object in TransactionsTable to prevent unnecessary re-renders and fix exhaustive-deps warning - Add optional success and message fields to backup API response types for proper error handling Backend: - Add TypedDict for transaction type configuration to improve type safety in generate_sample_db - Fix unpacking of amount_range with explicit float type hints - Add explicit type hints for descriptions dictionary and specific_descriptions variable - Fix sync endpoint return types: get_sync_status returns SyncStatus and sync_now returns SyncResult - Fix transactions endpoint data type declaration to properly support Union types in PaginatedResponse All checks now pass: - Frontend: npm lint and npm build ✓ - Backend: mypy type checking ✓ - Backend: ruff lint on modified files ✓ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Elisiário Couto
parent
966440006a
commit
159cba508e
@@ -8,8 +8,10 @@ from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
import tomli_w
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from leggen.commands.server import create_app
|
||||
from leggen.utils.config import Config
|
||||
|
||||
# Create test config before any imports that might load it
|
||||
@@ -27,15 +29,12 @@ _config_data = {
|
||||
"scheduler": {"sync": {"enabled": True, "hour": 3, "minute": 0}},
|
||||
}
|
||||
|
||||
import tomli_w
|
||||
with open(_test_config_path, "wb") as f:
|
||||
tomli_w.dump(_config_data, f)
|
||||
|
||||
# Set environment variables to point to test config BEFORE importing the app
|
||||
os.environ["LEGGEN_CONFIG_FILE"] = str(_test_config_path)
|
||||
|
||||
from leggen.commands.server import create_app
|
||||
|
||||
|
||||
def pytest_configure(config):
|
||||
"""Pytest hook called before test collection."""
|
||||
@@ -114,7 +113,9 @@ def mock_auth_token(temp_config_dir):
|
||||
def fastapi_app(mock_db_path):
|
||||
"""Create FastAPI test application."""
|
||||
# Patch the database path for the app
|
||||
with patch("leggen.utils.paths.path_manager.get_database_path", return_value=mock_db_path):
|
||||
with patch(
|
||||
"leggen.utils.paths.path_manager.get_database_path", return_value=mock_db_path
|
||||
):
|
||||
app = create_app()
|
||||
yield app
|
||||
|
||||
|
||||
Reference in New Issue
Block a user