abinazebinoy commited on
Commit
d7760bd
·
1 Parent(s): be7ca1d

feat(phase-35): add 15 frontend wiring tests

Browse files

TestEntityViewWiring (8 tests):
Promise.all includes timeline, graphAnalytics, investigate
6 tabs defined in tab-bar
3 new content panels present (timeline, forensics, analytics)
Tab switch array has all 6 tab names

TestForensicsPage (5 tests):
Views.forensics registered with router
All 3 forensic API calls present
Forensics nav link in index.html

TestHomeStats (2 tests):
Stats array has 6 entries (Relationships, Audit Reports)
Uses data.relationships for relationship count

Total: 15 new + 98 existing = 113 tests

Files changed (1) hide show
  1. tests/test_phase35_frontend.py +106 -0
tests/test_phase35_frontend.py ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+
4
+ class TestEntityViewWiring:
5
+ """Verify the entity view now includes all 6 API calls."""
6
+
7
+ def test_promise_all_includes_timeline(self):
8
+ with open("frontend/js/app.js", encoding="utf-8") as f:
9
+ app = f.read()
10
+ assert "Api.timeline(id)" in app
11
+
12
+ def test_promise_all_includes_graph_analytics(self):
13
+ with open("frontend/js/app.js", encoding="utf-8") as f:
14
+ app = f.read()
15
+ assert "Api.graphAnalytics(id" in app
16
+
17
+ def test_promise_all_includes_investigate(self):
18
+ with open("frontend/js/app.js", encoding="utf-8") as f:
19
+ app = f.read()
20
+ assert "Api.investigate(id)" in app
21
+
22
+ def test_six_tabs_defined(self):
23
+ with open("frontend/js/app.js", encoding="utf-8") as f:
24
+ app = f.read()
25
+ for tab in ["findings", "graph", "timeline", "forensics", "analytics", "evidence"]:
26
+ assert "data-tab="" + tab + """ in app, f"Tab {tab} not found"
27
+
28
+ def test_timeline_tab_content_panel(self):
29
+ with open("frontend/js/app.js", encoding="utf-8") as f:
30
+ app = f.read()
31
+ assert "tab-content-timeline" in app
32
+
33
+ def test_forensics_tab_content_panel(self):
34
+ with open("frontend/js/app.js", encoding="utf-8") as f:
35
+ app = f.read()
36
+ assert "tab-content-forensics" in app
37
+
38
+ def test_analytics_tab_content_panel(self):
39
+ with open("frontend/js/app.js", encoding="utf-8") as f:
40
+ app = f.read()
41
+ assert "tab-content-analytics" in app
42
+
43
+ def test_tab_switch_array_has_six_tabs(self):
44
+ with open("frontend/js/app.js", encoding="utf-8") as f:
45
+ app = f.read()
46
+ assert '"findings","graph","timeline","forensics","analytics","evidence"' in app
47
+
48
+
49
+ class TestForensicsPage:
50
+
51
+ def test_forensics_view_registered(self):
52
+ with open("frontend/js/app.js", encoding="utf-8") as f:
53
+ app = f.read()
54
+ assert "Views.forensics" in app
55
+ assert 'Router.register("/forensics"' in app
56
+
57
+ def test_forensics_view_calls_ghost_api(self):
58
+ with open("frontend/js/app.js", encoding="utf-8") as f:
59
+ app = f.read()
60
+ assert "forensicsGhostCompanies" in app
61
+
62
+ def test_forensics_view_calls_shadow_api(self):
63
+ with open("frontend/js/app.js", encoding="utf-8") as f:
64
+ app = f.read()
65
+ assert "forensicsShadowDirectors" in app
66
+
67
+ def test_forensics_view_calls_circular_api(self):
68
+ with open("frontend/js/app.js", encoding="utf-8") as f:
69
+ app = f.read()
70
+ assert "forensicsCircularOwnership" in app
71
+
72
+ def test_forensics_nav_link_in_html(self):
73
+ with open("frontend/index.html", encoding="utf-8") as f:
74
+ html = f.read()
75
+ assert "/forensics" in html
76
+
77
+
78
+ class TestHomeStats:
79
+
80
+ def test_home_stats_has_six_entries(self):
81
+ with open("frontend/js/app.js", encoding="utf-8") as f:
82
+ app = f.read()
83
+ # The expanded stats array has 6 entries
84
+ assert "Relationships" in app
85
+ assert "Audit Reports" in app
86
+
87
+ def test_home_stats_uses_relationship_count(self):
88
+ with open("frontend/js/app.js", encoding="utf-8") as f:
89
+ app = f.read()
90
+ assert "data.relationships" in app
91
+
92
+
93
+ class TestApiJsMethods:
94
+
95
+ def test_investigate_method_present(self):
96
+ with open("frontend/js/api.js", encoding="utf-8") as f:
97
+ apijs = f.read()
98
+ assert "investigate:" in apijs
99
+
100
+ def test_all_phase34_methods_present(self):
101
+ with open("frontend/js/api.js", encoding="utf-8") as f:
102
+ apijs = f.read()
103
+ for method in ["forensicsGhostCompanies", "forensicsShadowDirectors",
104
+ "forensicsCircularOwnership", "forensicsBenfords",
105
+ "selfLearningPatterns", "caseMemoryStats"]:
106
+ assert method in apijs, f"Missing: {method}"