fix: resolve CI failures — ESLint unused vars and AI chat tests in CI
Frontend: suppress unused-vars ESLint errors for callback params in MaintenanceFlowDetailPage and StepLibraryPage. Backend: add autouse fixture to mock settings.ai_enabled=True in test_ai_chat.py so tests pass in CI where no ANTHROPIC_API_KEY is set. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,11 +3,22 @@
|
|||||||
These tests mock the AI provider to avoid real API calls.
|
These tests mock the AI provider to avoid real API calls.
|
||||||
"""
|
"""
|
||||||
import pytest
|
import pytest
|
||||||
from unittest.mock import AsyncMock, patch
|
from unittest.mock import AsyncMock, patch, PropertyMock
|
||||||
|
|
||||||
pytestmark = pytest.mark.asyncio
|
pytestmark = pytest.mark.asyncio
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def _enable_ai():
|
||||||
|
"""Ensure ai_enabled returns True even without API keys in CI."""
|
||||||
|
with patch(
|
||||||
|
"app.core.config.Settings.ai_enabled",
|
||||||
|
new_callable=PropertyMock,
|
||||||
|
return_value=True,
|
||||||
|
):
|
||||||
|
yield
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mock_ai_provider():
|
def mock_ai_provider():
|
||||||
"""Mock AI provider that returns realistic responses."""
|
"""Mock AI provider that returns realistic responses."""
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ export default function MaintenanceFlowDetailPage() {
|
|||||||
load()
|
load()
|
||||||
}, [id, navigate])
|
}, [id, navigate])
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
const handleLaunched = (batchId: string, _count: number) => {
|
const handleLaunched = (batchId: string, _count: number) => {
|
||||||
setShowBatchModal(false)
|
setShowBatchModal(false)
|
||||||
setBannerDismissed(false)
|
setBannerDismissed(false)
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ export default function StepLibraryPage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
const handleFormSuccess = (_step: Step) => {
|
const handleFormSuccess = (_step: Step) => {
|
||||||
setCreateOpen(false)
|
setCreateOpen(false)
|
||||||
setEditingStep(null)
|
setEditingStep(null)
|
||||||
|
|||||||
Reference in New Issue
Block a user