feat(alerts/ui): add severityToAccent helper for DataTable rowAccent

Pure function mapping the 3-value AlertDto.severity enum to the 2-value
DataTable rowAccent prop. INFO maps to undefined (no tint) because the
DS DataTable rowAccent only supports error|warning.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-21 09:57:58 +02:00
parent 52a08a8769
commit a2b2ccbab7
2 changed files with 28 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
import { describe, it, expect } from 'vitest';
import { severityToAccent } from './severity-utils';
describe('severityToAccent', () => {
it('maps CRITICAL → error', () => {
expect(severityToAccent('CRITICAL')).toBe('error');
});
it('maps WARNING → warning', () => {
expect(severityToAccent('WARNING')).toBe('warning');
});
it('maps INFO → undefined (no row tint)', () => {
expect(severityToAccent('INFO')).toBeUndefined();
});
});