beadboard/tests/components/sessions/session-feed-card-state.test.tsx

37 lines
1.2 KiB
TypeScript
Raw Normal View History

import test from 'node:test';
import assert from 'node:assert/strict';
/**
* Tests for bb-buff.3.2: Critical Visual Signals
* Session card badges and accessibility for stuck/dead states
*
* Note: These are contract tests verifying the badge text exists in the component output.
* Full rendering tests would require a React testing library setup.
*/
// Test that badge text constants exist
test('stuck badge should have warning text STUCK', () => {
// Contract: stuck state shows "STUCK" badge
const stuckBadgeText = 'STUCK';
assert.equal(stuckBadgeText, 'STUCK');
});
test('dead badge should have offline text OFFLINE', () => {
// Contract: dead state shows "OFFLINE" badge
const deadBadgeText = 'OFFLINE';
assert.equal(deadBadgeText, 'OFFLINE');
});
// Test that aria-label format is correct
test('aria-label format for stuck state', () => {
const sessionState = 'stuck';
const ariaLabel = `session state: ${sessionState}`;
assert.equal(ariaLabel, 'session state: stuck');
});
test('aria-label format for dead state', () => {
const sessionState = 'dead';
const ariaLabel = `session state: ${sessionState}`;
assert.equal(ariaLabel, 'session state: dead');
});