Files
dss/tests/test_project_analyzer.py
Bruno Sarlo 41fba59bf7 Major refactor: Consolidate DSS into unified package structure
- Create new dss/ Python package at project root
- Move MCP core from tools/dss_mcp/ to dss/mcp/
- Move storage layer from tools/storage/ to dss/storage/
- Move domain logic from dss-mvp1/dss/ to dss/
- Move services from tools/api/services/ to dss/services/
- Move API server to apps/api/
- Move CLI to apps/cli/
- Move Storybook assets to storybook/
- Create unified dss/__init__.py with comprehensive exports
- Merge configuration into dss/settings.py (Pydantic-based)
- Create pyproject.toml for proper package management
- Update startup scripts for new paths
- Remove old tools/ and dss-mvp1/ directories

Architecture changes:
- DSS is now MCP-first with 40+ tools for Claude Code
- Clean imports: from dss import Projects, Components, FigmaToolSuite
- No more sys.path.insert() hacking
- apps/ contains thin application wrappers (API, CLI)
- Single unified Python package for all DSS logic

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-10 12:46:43 -03:00

46 lines
1.7 KiB
Python

import pytest
import json
from pathlib import Path
from dss.analyze.project_analyzer import run_project_analysis
def test_run_project_analysis(mock_react_project: Path):
"""
Tests the run_project_analysis function to ensure it creates the analysis graph
and that the graph contains the expected file nodes.
"""
# Run the analysis on the mock project
run_project_analysis(str(mock_react_project))
# Check if the analysis file was created
analysis_file = mock_react_project / ".dss" / "analysis_graph.json"
assert analysis_file.exists(), "The analysis_graph.json file was not created."
# Load the analysis data
with open(analysis_file, 'r') as f:
data = json.load(f)
# Verify the graph structure
assert "nodes" in data, "Graph data should contain 'nodes'."
assert "links" in data, "Graph data should contain 'links'."
# Get a list of node IDs (which are the relative file paths)
node_ids = [node['id'] for node in data['nodes']]
# Check for the presence of the files from the mock project
expected_files = [
"package.json",
"src/App.js",
"src/components/ComponentA.css",
"src/components/ComponentA.jsx",
"src/components/ComponentB.tsx",
]
for file_path in expected_files:
# Path separators might be different on different OSes, so we normalize
normalized_path = str(Path(file_path))
assert normalized_path in node_ids, f"Expected file '{normalized_path}' not found in the analysis graph."
# Verify the number of nodes
# There should be exactly the number of files we created
assert len(node_ids) == len(expected_files), "The number of nodes in the graph does not match the number of files."