Skip to content

Commit 66f0f97

Browse files
SchenLongclaude
andcommitted
test: final Phase 2 fixes — sensei MODULE_CONTEXT + threat title assertions
Three small follow-ups after the full suite run completed for the first time: - src/lib/sensei/__tests__/system-prompt.test.ts: MODULE_CONTEXT test had a hardcoded expectedIds list with 'llm' instead of 'jutsu'. Train 2 PR-4b.6.1 renamed the NavId but missed this assertion. Updated the list to use 'jutsu' and added the 5 PR-4b.1/4b.2 additions (mitsuke, dna, kagami, arena, buki) that the MODULE_CONTEXT map now carries. - src/components/__tests__/threat-radar.test.tsx & - src/components/__tests__/threat-trend-widget.test.tsx: `screen.getByText(/Threat|Radar/i)` matched multiple elements once the real WidgetCard rendered its title alongside the inner component's own title text. Switched to `getAllByText(...).length > 0` which is semantically equivalent and tolerant of the multi-match. Final suite state (783/790 files, 11950/11984 tests = 99.72% pass rate): Remaining 34 failures are all confirmed pre-existing bugs, verified at commit 439dad0 (pre-Train-2 tip). None are Train 2 regressions. Breakdown: - route-guard.test.ts (24): pre-existing handler returns 500 in test env - admin-validation-api.test.ts (3): same 500 handler issue - kill-count.test.tsx (3): UI label text drift - guard-stats-card.test.tsx (1): donut segment rendering - llm-jutsu-widget.test.tsx (1): fallback count mismatch - agentic/route.test.ts (2): json.data.scenario missing from response All logged in team/lessonslearned.md for follow-up in the next test pass. Train 2 test regression fix pass is complete — PR-4c.1 can now open. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5312a63 commit 66f0f97

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

packages/dojolm-web/src/components/__tests__/threat-radar.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ import { ThreatRadar } from '../dashboard/widgets/ThreatRadar'
3434

3535
describe('ThreatRadar', () => {
3636
it('renders without crashing', () => { expect(render(<ThreatRadar />).container).toBeTruthy() })
37-
it('displays title', () => { render(<ThreatRadar />); expect(screen.getByText(/Threat|Radar/i)).toBeInTheDocument() })
37+
it('displays title', () => { render(<ThreatRadar />); expect(screen.getAllByText(/Threat|Radar/i).length).toBeGreaterThan(0) })
3838
it('wraps in WidgetCard', () => { render(<ThreatRadar />); expect(screen.getByTestId('widget-card')).toBeInTheDocument() })
3939
})

packages/dojolm-web/src/components/__tests__/threat-trend-widget.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ import { ThreatTrendWidget } from '../dashboard/widgets/ThreatTrendWidget'
3434

3535
describe('ThreatTrendWidget', () => {
3636
it('renders without crashing', () => { expect(render(<ThreatTrendWidget />).container).toBeTruthy() })
37-
it('displays title', () => { render(<ThreatTrendWidget />); expect(screen.getByText(/Threat|Trend/i)).toBeInTheDocument() })
37+
it('displays title', () => { render(<ThreatTrendWidget />); expect(screen.getAllByText(/Threat|Trend/i).length).toBeGreaterThan(0) })
3838
it('wraps in WidgetCard', () => { render(<ThreatTrendWidget />); expect(screen.getByTestId('widget-card')).toBeInTheDocument() })
3939
})

packages/dojolm-web/src/lib/sensei/__tests__/system-prompt.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,15 @@ describe('getSystemMessageBuilder', () => {
121121
});
122122

123123
describe('MODULE_CONTEXT', () => {
124-
it('covers all 12 NavIds', () => {
124+
// Train 2 PR-4b.6 (2026-04-09): 'llm' NavId renamed to 'jutsu' as part of the
125+
// LLM Dashboard decomposition. MODULE_CONTEXT now has entries for the
126+
// promoted NavIds from PR-4b.1 (mitsuke, dna, kagami, arena, buki) too.
127+
it('covers all canonical NavIds', () => {
125128
const expectedIds = [
126-
'dashboard', 'scanner', 'armory', 'llm', 'guard', 'compliance',
129+
'dashboard', 'scanner', 'armory', 'jutsu', 'guard', 'compliance',
127130
'adversarial', 'strategic', 'ronin-hub', 'sengoku', 'kotoba', 'admin',
131+
// Train 2 PR-4b.1 + PR-4b.2 additions:
132+
'mitsuke', 'dna', 'kagami', 'arena', 'buki',
128133
];
129134
for (const id of expectedIds) {
130135
expect(MODULE_CONTEXT).toHaveProperty(id);

0 commit comments

Comments
 (0)