-
Notifications
You must be signed in to change notification settings - Fork 0
fix(coachhelm): coach-facing surfaces speak coach voice, not player voice #931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| // @vitest-environment jsdom | ||
| /** | ||
| * ============================================================================ | ||
| * InsightCard.tsx — `iconTone` valence override (bug #915) | ||
| * ---------------------------------------------------------------------------- | ||
| * A mined pattern's icon/accent was previously always derived from | ||
| * `priority` — a severity tier bucketed by |stroke_impact| MAGNITUDE, blind | ||
| * to sign. That let a high-magnitude plays-BETTER pattern land in the 'high' | ||
| * tier (a warning-orange flame, as if it were bad news) while a | ||
| * low-magnitude plays-WORSE pattern landed in 'medium' (a green sparkle, as | ||
| * if it were good news). | ||
| * | ||
| * These tests lock the fix: `iconTone` overrides BOTH the glyph and its | ||
| * wrap color independent of `priority`, so a caller with a genuinely signed | ||
| * metric can make icon+accent agree with "good or bad for the player" | ||
| * instead of "how large is this number". | ||
| * ========================================================================== */ | ||
| import { describe, it, expect } from 'vitest'; | ||
| import { render } from '@testing-library/react'; | ||
| import { InsightCard } from './InsightCard'; | ||
|
|
||
| /** The rendered lead icon's wrap <span> — carries the color classes. */ | ||
| function iconWrapClassName(container: HTMLElement): string { | ||
| const svg = container.querySelector('svg'); | ||
| expect(svg).not.toBeNull(); | ||
| const wrap = svg!.parentElement; | ||
| expect(wrap).not.toBeNull(); | ||
| return wrap!.className; | ||
| } | ||
|
|
||
| describe('InsightCard — iconTone valence override', () => { | ||
| it('with no iconTone, the icon wrap follows priority (unchanged default behavior)', () => { | ||
| const { container } = render( | ||
| <InsightCard priority="critical" title="Critical signal" />, | ||
| ); | ||
| const cls = iconWrapClassName(container); | ||
| expect(cls).toContain('text-fw-danger'); | ||
| expect(cls).toContain('bg-fw-danger-bg'); | ||
| }); | ||
|
|
||
| it('iconTone="positive" renders the success wrap even on a "critical" priority card', () => { | ||
| // Regression lock: a HIGH-magnitude plays-better pattern (severity | ||
| // 'critical') must still read as good news, not an alarm. | ||
| const { container } = render( | ||
| <InsightCard priority="critical" iconTone="positive" title="Plays better under fatigue" />, | ||
| ); | ||
| const cls = iconWrapClassName(container); | ||
| expect(cls).toContain('text-fw-success'); | ||
| expect(cls).toContain('bg-fw-success-bg'); | ||
| expect(cls).not.toContain('bg-fw-danger-bg'); | ||
| }); | ||
|
|
||
| it('iconTone="negative" renders the warning wrap even on a "medium"/"low" priority card', () => { | ||
| // Regression lock: a LOW-magnitude plays-worse pattern (severity | ||
| // 'medium'/'low') must still read as a leak, not a strength. | ||
| const { container: medium } = render( | ||
| <InsightCard priority="medium" iconTone="negative" title="Small leak" />, | ||
| ); | ||
| expect(iconWrapClassName(medium)).toContain('bg-fw-warning-bg'); | ||
| expect(iconWrapClassName(medium)).not.toContain('bg-fw-success-bg'); | ||
|
|
||
| const { container: low } = render( | ||
| <InsightCard priority="low" iconTone="negative" title="Small leak" />, | ||
| ); | ||
| expect(iconWrapClassName(low)).toContain('bg-fw-warning-bg'); | ||
| }); | ||
|
|
||
| it('iconTone="neutral" renders the neutral wrap regardless of priority', () => { | ||
| const { container } = render( | ||
| <InsightCard priority="high" iconTone="neutral" title="No clear direction" />, | ||
| ); | ||
| const cls = iconWrapClassName(container); | ||
| expect(cls).toContain('bg-surface-sunken'); | ||
| expect(cls).not.toContain('bg-fw-warning-bg'); | ||
| }); | ||
|
|
||
| it('two cards with the SAME priority tier but OPPOSITE iconTone render visibly different wraps', () => { | ||
| // The exact reported shape: same magnitude tier, opposite sign. | ||
| const { container: better } = render( | ||
| <InsightCard priority="medium" iconTone="positive" title="Better" />, | ||
| ); | ||
| const { container: worse } = render( | ||
| <InsightCard priority="medium" iconTone="negative" title="Worse" />, | ||
| ); | ||
| expect(iconWrapClassName(better)).not.toBe(iconWrapClassName(worse)); | ||
| }); | ||
|
|
||
| it('undefined iconTone is a true no-op — identical to omitting the prop entirely', () => { | ||
| const { container: omitted } = render(<InsightCard priority="low" title="A" />); | ||
| const { container: explicitUndefined } = render( | ||
| <InsightCard priority="low" iconTone={undefined} title="A" />, | ||
| ); | ||
| expect(iconWrapClassName(omitted)).toBe(iconWrapClassName(explicitUndefined)); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: njrini99-code/helmv3
Length of output: 15653
🏁 Script executed:
Repository: njrini99-code/helmv3
Length of output: 6408
🏁 Script executed:
Repository: njrini99-code/helmv3
Length of output: 14368
Add the missing
framer-motiontest mocksrc/test/setup.tsx:12-67mocksnext/navigation,next/font/google,next/image, and@number-flow/react, but notframer-motion.InsightCard.test.tsx:18-20needs a localvi.mock('framer-motion', ...)or a shared mock withuseReducedMotionso these assertions stay deterministic.🤖 Prompt for AI Agents
Source: Path instructions