ppt-tool/backend/tests/test_slide_mapping.py
Vadym Samoilenko 76a4e41e3b Phase 7: Testing Suite — backend unit tests + Cypress E2E framework
Backend:
- conftest with async SQLite DB, factory fixtures for all models
- pytest-asyncio config in pyproject.toml
- Tests: auth (JWT, dev login), RBAC (access service), audit (query, export),
  brand enforcement (colors, fonts, logos, contrast), retention (cleanup, purge),
  content intelligence (regex classifiers), slide mapping, review workflow,
  analytics data queries

Frontend:
- Cypress E2E config with baseUrl and viewport settings
- Custom commands (devLogin, createPresentation)
- E2E specs: login flow, wizard navigation, admin panel, review workflow
- Test scripts in package.json

Infrastructure:
- Makefile: test-e2e and test-all targets

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 16:49:23 +00:00

34 lines
1.4 KiB
Python

"""Tests for SlideMappingEngine: block-to-layout type mapping."""
import pytest
from models.content_models import ContentBlock, ContentBlockType
from services.slide_mapping_engine import _BLOCK_TO_LAYOUT_TYPE
class TestBlockToLayoutMapping:
"""Verify every content block type has layout mappings defined."""
def test_all_block_types_have_mappings(self):
for bt in ContentBlockType:
assert bt in _BLOCK_TO_LAYOUT_TYPE, (
f"ContentBlockType.{bt.value} missing from _BLOCK_TO_LAYOUT_TYPE"
)
def test_metric_prefers_metrics_layout(self):
assert _BLOCK_TO_LAYOUT_TYPE[ContentBlockType.metric][0] == "metrics"
def test_quote_prefers_quote_layout(self):
assert _BLOCK_TO_LAYOUT_TYPE[ContentBlockType.quote][0] == "quote"
def test_table_prefers_table_layout(self):
assert _BLOCK_TO_LAYOUT_TYPE[ContentBlockType.table][0] == "table"
def test_timeline_prefers_timeline_layout(self):
assert _BLOCK_TO_LAYOUT_TYPE[ContentBlockType.timeline][0] == "timeline"
def test_every_mapping_has_content_fallback(self):
"""Each block type should have 'content' as a fallback layout."""
for bt, layouts in _BLOCK_TO_LAYOUT_TYPE.items():
assert "content" in layouts, (
f"ContentBlockType.{bt.value} has no 'content' fallback in layout mapping"
)