import pytest
from pathlib import Path

@pytest.fixture(scope="function")
def mock_react_project(tmp_path: Path) -> Path:
    """
    Creates a temporary mock React project structure for testing.
    """
    project_dir = tmp_path / "test-project"
    project_dir.mkdir()

    # Create src directory
    src_dir = project_dir / "src"
    src_dir.mkdir()

    # Create components directory
    components_dir = src_dir / "components"
    components_dir.mkdir()

    # Component A
    (components_dir / "ComponentA.jsx").write_text("""
import React from 'react';
import './ComponentA.css';

const ComponentA = () => {
    return <div className="component-a">Component A</div>;
};

export default ComponentA;
    """)

    (components_dir / "ComponentA.css").write_text("""
.component-a {
    color: blue;
}
    """)

    # Component B
    (components_dir / "ComponentB.tsx").write_text("""
import React from 'react';
import ComponentA from './ComponentA';

const ComponentB = () => {
    return (
        <div>
            <ComponentA />
        </div>
    );
};

export default ComponentB;
    """)

    # App.js
    (src_dir / "App.js").write_text("""
import React from 'react';
import ComponentB from './components/ComponentB';

function App() {
    return (
        <div className="App">
            <ComponentB />
        </div>
    );
}

export default App;
    """)
    
    # package.json
    (project_dir / "package.json").write_text("""
{
    "name": "test-project",
    "version": "0.1.0",
    "private": true,
    "dependencies": {
        "react": "^18.0.0"
    }
}
    """)

    return project_dir
