Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

1.1 KB
Raw Blame
import { describe, expect, it } from 'vitest';
import {
  getRecoveryOutcomeBadgeClass,
  getRecoveryOutcomeLabel,
  normalizeRecoveryOutcome,
} from '@/utils/recoveryOutcomePresentation';

describe('recoveryOutcomePresentation', () => {
  it('normalizes known outcomes', () => {
    expect(normalizeRecoveryOutcome(' Failed ')).toBe('failed');
  });

  it('normalizes recovery aliases onto canonical outcomes', () => {
    expect(normalizeRecoveryOutcome('ok')).toBe('success');
    expect(normalizeRecoveryOutcome('warn')).toBe('warning');
    expect(normalizeRecoveryOutcome('failure')).toBe('failed');
  });

  it('falls back unknown outcomes', () => {
    expect(normalizeRecoveryOutcome('partial')).toBe('unknown');
  });

  it('maps failed outcomes to danger styling', () => {
    expect(getRecoveryOutcomeBadgeClass('failed')).toContain('red-100');
  });

  it('maps running outcomes to informational styling', () => {
    expect(getRecoveryOutcomeBadgeClass('running')).toContain('blue-100');
  });

  it('exposes canonical outcome labels', () => {
    expect(getRecoveryOutcomeLabel('success')).toBe('Healthy');
  });
});