Public source validation / validate (push) Failing after 3m8s
28 lines
1.5 KiB
TypeScript
28 lines
1.5 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import { containerSignalTone, signalToneFromState, sourceSignalTone, worstSignalTone } from '../../src/overviewSignals';
|
|
|
|
describe('overview signal semantics', () => {
|
|
it('fails source provenance closed when freshness is stale or unavailable', () => {
|
|
expect(sourceSignalTone({ state: 'healthy', freshness: 'stale' })).toBe('stale');
|
|
expect(sourceSignalTone({ state: 'healthy', freshness: 'unavailable' })).toBe('unknown');
|
|
expect(sourceSignalTone({ state: 'degraded', freshness: 'fresh' })).toBe('attention');
|
|
expect(sourceSignalTone({ state: 'healthy', freshness: 'fresh' })).toBe('healthy');
|
|
expect(sourceSignalTone(undefined)).toBe('unknown');
|
|
});
|
|
|
|
it('mirrors container domain state without escalating intentional stops', () => {
|
|
expect(containerSignalTone({ state: 'running', health: 'healthy' })).toBe('healthy');
|
|
expect(containerSignalTone({ state: 'running', health: 'unhealthy' })).toBe('attention');
|
|
expect(containerSignalTone({ state: 'restarting', health: 'unknown' })).toBe('attention');
|
|
expect(containerSignalTone({ state: 'stopped', health: 'unknown' })).toBe('critical');
|
|
expect(containerSignalTone({ state: 'stopped', health: 'unknown', intentionalStop: true })).toBe('unknown');
|
|
});
|
|
|
|
it('keeps the most severe state deterministically', () => {
|
|
expect(signalToneFromState('DOWN')).toBe('critical');
|
|
expect(worstSignalTone(['healthy', 'unknown', 'attention', 'stale'])).toBe('attention');
|
|
expect(worstSignalTone([])).toBe('unknown');
|
|
});
|
|
});
|