import { describe, expect, it } from 'vitest';
import type { PhotoModerationAction } from './photoModerationQueue';
import { countQueuedPhotoActions } from './queueStatus';

const baseAction = (overrides: Partial<PhotoModerationAction>): PhotoModerationAction => ({
  id: overrides.id ?? '1',
  eventSlug: overrides.eventSlug ?? 'event-a',
  photoId: overrides.photoId ?? 1,
  action: overrides.action ?? 'approve',
  createdAt: overrides.createdAt ?? new Date().toISOString(),
});

describe('countQueuedPhotoActions', () => {
  it('returns total count when slug is not provided', () => {
    const queue = [baseAction({ id: '1' }), baseAction({ id: '2', eventSlug: 'event-b' })];
    expect(countQueuedPhotoActions(queue)).toBe(2);
  });

  it('filters by slug when provided', () => {
    const queue = [baseAction({ id: '1' }), baseAction({ id: '2', eventSlug: 'event-b' })];
    expect(countQueuedPhotoActions(queue, 'event-a')).toBe(1);
  });
});
