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.

835 B
Raw Blame
import { describe, expect, it } from 'vitest';

import { getAlertIdentifiers, getCanonicalAlertId, matchesAlertIdentifier } from './identity';

describe('alert identity helpers', () => {
  it('treats id as the canonical alert identifier', () => {
    expect(getCanonicalAlertId({ id: 'resource-a::spec-b' })).toBe('resource-a::spec-b');
  });

  it('returns only the canonical alert identifier', () => {
    expect(getAlertIdentifiers({ id: 'canonical-alert-1' })).toEqual(['canonical-alert-1']);
  });

  it('matches only the canonical identifier', () => {
    const alert = { id: 'canonical-alert-1' };
    expect(matchesAlertIdentifier(alert, 'canonical-alert-1')).toBe(true);
    expect(matchesAlertIdentifier(alert, 'legacy-alert-1')).toBe(false);
    expect(matchesAlertIdentifier(alert, 'missing-alert')).toBe(false);
  });
});