"""Tests for Confirmed strategy."""

import pytest
from decimal import Decimal
from src.strategies.technical.confirmed_strategy import ConfirmedStrategy
from src.strategies.base import SignalType


class TestConfirmedStrategy:
    """Tests for ConfirmedStrategy."""
    
    @pytest.fixture
    def strategy(self):
        """Create Confirmed strategy instance."""
        return ConfirmedStrategy(
            name="test_confirmed",
            parameters={
                'rsi_period': 14,
                'macd_fast': 12,
                'macd_slow': 26,
                'macd_signal': 9,
                'ma_fast': 10,
                'ma_slow': 30,
                'min_confirmations': 2,
                'require_rsi': True,
                'require_macd': True,
                'require_ma': True
            }
        )
    
    def test_initialization(self, strategy):
        """Test strategy initialization."""
        assert strategy.rsi_period == 14
        assert strategy.macd_fast == 12
        assert strategy.ma_fast == 10
        assert strategy.min_confirmations == 2
    
    def test_on_tick_insufficient_data(self, strategy):
        """Test that strategy returns None with insufficient data."""
        signal = strategy.on_tick(
            symbol="BTC/USD",
            price=Decimal("50000"),
            timeframe="1h",
            data={'volume': 1000}
        )
        assert signal is None
    
    def test_min_confirmations_requirement(self, strategy):
        """Test that signal requires minimum confirmations."""
        # This would require actual price history to generate real signals
        # For now, we test the structure
        assert strategy.min_confirmations == 2
        assert strategy.require_rsi is True
        assert strategy.require_macd is True
        assert strategy.require_ma is True
    
    def test_strategy_metadata(self, strategy):
        """Test strategy metadata."""
        assert strategy.name == "test_confirmed"
        assert strategy.enabled is False

