Migrated from design-system-swarm with fresh git history.
Old project history preserved in /home/overbits/apps/design-system-swarm
Core components:
- MCP Server (Python FastAPI with mcp 1.23.1)
- Claude Plugin (agents, commands, skills, strategies, hooks, core)
- DSS Backend (dss-mvp1 - token translation, Figma sync)
- Admin UI (Node.js/React)
- Server (Node.js/Express)
- Storybook integration (dss-mvp1/.storybook)
Self-contained configuration:
- All paths relative or use DSS_BASE_PATH=/home/overbits/dss
- PYTHONPATH configured for dss-mvp1 and dss-claude-plugin
- .env file with all configuration
- Claude plugin uses ${CLAUDE_PLUGIN_ROOT} for portability
Migration completed: $(date)
🤖 Clean migration with full functionality preserved
86 lines
3.2 KiB
Python
86 lines
3.2 KiB
Python
"""Unit tests for default DSS themes"""
|
|
|
|
import pytest
|
|
from dss.themes import get_default_light_theme, get_default_dark_theme
|
|
from dss.models.theme import TokenCategory
|
|
|
|
|
|
@pytest.mark.unit
|
|
class TestDefaultThemes:
|
|
"""Test default light & dark themes"""
|
|
|
|
def test_light_theme_structure(self):
|
|
"""Test light theme has correct structure"""
|
|
theme = get_default_light_theme()
|
|
assert theme.name == "DSS Light"
|
|
assert theme.version == "1.0.0"
|
|
assert len(theme.tokens) > 20
|
|
|
|
def test_dark_theme_structure(self):
|
|
"""Test dark theme has correct structure"""
|
|
theme = get_default_dark_theme()
|
|
assert theme.name == "DSS Dark"
|
|
assert theme.version == "1.0.0"
|
|
assert len(theme.tokens) > 20
|
|
|
|
def test_themes_have_same_token_names(self):
|
|
"""Test light and dark themes have matching token names"""
|
|
light = get_default_light_theme()
|
|
dark = get_default_dark_theme()
|
|
|
|
light_tokens = set(light.tokens.keys())
|
|
dark_tokens = set(dark.tokens.keys())
|
|
|
|
assert light_tokens == dark_tokens, "Light and dark themes must have same token names"
|
|
|
|
def test_color_tokens_present(self):
|
|
"""Test essential color tokens are present"""
|
|
theme = get_default_light_theme()
|
|
required_colors = ["background", "foreground", "primary", "secondary",
|
|
"accent", "destructive", "success", "warning"]
|
|
|
|
for color in required_colors:
|
|
assert color in theme.tokens
|
|
assert theme.tokens[color].category == TokenCategory.COLOR
|
|
|
|
def test_spacing_tokens_present(self):
|
|
"""Test spacing tokens are present"""
|
|
theme = get_default_light_theme()
|
|
spacing_tokens = theme.get_tokens_by_category(TokenCategory.SPACING)
|
|
|
|
assert len(spacing_tokens) == 5 # xs, sm, md, lg, xl
|
|
assert "space-md" in spacing_tokens
|
|
|
|
def test_radius_tokens_present(self):
|
|
"""Test border radius tokens are present"""
|
|
theme = get_default_light_theme()
|
|
radius_tokens = theme.get_tokens_by_category(TokenCategory.RADIUS)
|
|
|
|
assert len(radius_tokens) == 3 # sm, md, lg
|
|
assert "radius-md" in radius_tokens
|
|
|
|
def test_typography_tokens_present(self):
|
|
"""Test typography tokens are present"""
|
|
theme = get_default_light_theme()
|
|
typo_tokens = theme.get_tokens_by_category(TokenCategory.TYPOGRAPHY)
|
|
|
|
assert len(typo_tokens) == 5 # xs, sm, base, lg, xl
|
|
assert "text-base" in typo_tokens
|
|
|
|
def test_dark_theme_colors_different_from_light(self):
|
|
"""Test dark theme has different color values than light"""
|
|
light = get_default_light_theme()
|
|
dark = get_default_dark_theme()
|
|
|
|
# Background should be inverted
|
|
assert light.tokens["background"].value != dark.tokens["background"].value
|
|
assert light.tokens["foreground"].value != dark.tokens["foreground"].value
|
|
|
|
def test_theme_token_values_are_valid(self):
|
|
"""Test all token values are non-empty strings"""
|
|
theme = get_default_light_theme()
|
|
|
|
for token_name, token in theme.tokens.items():
|
|
assert token.value, f"Token {token_name} has empty value"
|
|
assert token.description, f"Token {token_name} has no description"
|