test(native-chat): pin the strip's monitor amber to the constant that defines it

`MONITOR_GLYPH_COLOR`'s comment claimed a test held it and AgentStateDot's amber
together, but no test imported it — the assertions hardcoded 'text-yellow-500',
so the two could drift with every test still green. Read the colour from the
module, which is what the comment always said was happening. Drop the unused
`BackgroundTaskGlyph` export too: nothing outside the module names it.
This commit is contained in:
Merge Sim
2026-09-09 13:05:07 -07:00
parent 70dda28faf
commit 1dd39889fc
2 changed files with 8 additions and 5 deletions
@@ -6,6 +6,7 @@ import { cleanup, fireEvent, render, screen } from '@testing-library/react'
import { afterEach, describe, expect, it, vi } from 'vitest'
import type { AgentSessionBackgroundTask } from '../../../../shared/agent-session-wire'
import { NativeChatBackgroundTasksStatus } from './NativeChatBackgroundTasksStatus'
import { MONITOR_GLYPH_COLOR } from './native-chat-background-task-kinds'
import { AgentStateDot } from '@/components/AgentStateDot'
afterEach(cleanup)
@@ -86,16 +87,18 @@ describe('NativeChatBackgroundTasksStatus row glyphs', () => {
})
it('gives the monitor heartbeat the amber the monitoring dot uses', () => {
// Same glyph on a muted grey would not read as the same thing.
expect(glyphSlotClassFor('monitor')).toContain('text-yellow-500')
// Same glyph on a muted grey would not read as the same thing. Reading the
// colour from the module is what actually pins the two together: a hardcoded
// string here would let the strip and the dot drift apart silently.
expect(glyphSlotClassFor('monitor')).toContain(MONITOR_GLYPH_COLOR)
cleanup()
const { container } = render(<AgentStateDot state="monitoring" size="md" title={null} />)
expect(container.querySelector('svg')?.getAttribute('class')).toContain('text-yellow-500')
expect(container.querySelector('svg')?.getAttribute('class')).toContain(MONITOR_GLYPH_COLOR)
})
it('leaves the other kinds muted, so only monitoring reads as a state', () => {
for (const kind of ['agent', 'command', 'workflow', 'unknown'] as const) {
expect(glyphSlotClassFor(kind)).not.toContain('text-yellow-500')
expect(glyphSlotClassFor(kind)).not.toContain(MONITOR_GLYPH_COLOR)
cleanup()
}
})
@@ -18,7 +18,7 @@ type BackgroundTaskKind = AgentSessionBackgroundTask['kind']
/** `heartbeat` is deliberately outside the tool table: monitoring is one idea
* app-wide, and the heartbeat is the glyph that already stands for it in the
* agent sidebar and on AgentStateDot. A second monitor glyph would split it. */
export type BackgroundTaskGlyph = NativeChatToolIconName | 'heartbeat'
type BackgroundTaskGlyph = NativeChatToolIconName | 'heartbeat'
const KIND_GLYPHS: Record<BackgroundTaskKind, BackgroundTaskGlyph> = {
agent: 'bot',