import { describe, expect, test } from 'bun:test';

import { getAllMetrics, incrementMetric } from '../observability/metrics';

describe('observability metrics', () => {
  test('initializes and increments named counters', () => {
    const metricName = `requests_${Date.now()}`;

    incrementMetric(metricName);
    incrementMetric(metricName, 2);

    expect(getAllMetrics()[metricName]).toBe(3);
  });

  test('tracks multiple counters independently', () => {
    const metricA = `camera_${Date.now()}_a`;
    const metricB = `camera_${Date.now()}_b`;

    incrementMetric(metricA, 5);
    incrementMetric(metricB, 2);

    const metrics = getAllMetrics();
    expect(metrics[metricA]).toBe(5);
    expect(metrics[metricB]).toBe(2);
  });
});
