-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathtest_routes.py
More file actions
47 lines (32 loc) · 1.48 KB
/
test_routes.py
File metadata and controls
47 lines (32 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""Integration tests for all routes in Reflex."""
import sys
from collections import Counter
from pathlib import Path
import pytest
sys.path.append(str(Path(__file__).resolve().parent.parent))
@pytest.fixture
def routes_fixture():
from reflex_docs.pages import routes
yield routes
def test_unique_routes(routes_fixture):
assert routes_fixture is not None
paths = [route.path for route in routes_fixture if route.path]
# Count occurrences of each path
path_counts = Counter(paths)
# Find duplicate paths
duplicates = {path: count for path, count in path_counts.items() if count > 1}
# Assert that there are no duplicates
assert len(duplicates) == 0, f"Duplicate routes found: {duplicates}"
print(f"Test passed. All {len(paths)} routes are unique.")
def test_ai_builder_routes_use_ai_prefix(routes_fixture):
paths = {route.path for route in routes_fixture if route.path}
assert "/ai/overview/best-practices/" in paths
assert "/ai/integrations/agent-toolkit/" in paths
assert "/ai/integrations/mcp-overview/" in paths
assert "/ai/integrations/skills/" in paths
assert "/ai/integrations/ai-onboarding/" not in paths
assert "/ai-builder/overview/best-practices/" not in paths
assert "/ai-builder/integrations/ai-onboarding/" not in paths
assert "/ai-builder/integrations/agent-toolkit/" not in paths
assert "/ai-builder/integrations/mcp-overview/" not in paths
assert "/ai-builder/integrations/skills/" not in paths