import { describe, expect, it } from 'vitest';
import { shouldVoidStaleArchive } from '../settle-archives';

describe('shouldVoidStaleArchive', () => {
  const now = new Date('2026-03-31T03:00:00.000Z');

  it('does not void recent unresolved archives', () => {
    expect(shouldVoidStaleArchive('2026-03-28T04:00:01.000Z', now)).toBe(false);
  });

  it('voids unresolved archives older than the threshold', () => {
    expect(shouldVoidStaleArchive('2026-03-23T03:00:00.000Z', now)).toBe(true);
  });

  it('ignores invalid timestamps', () => {
    expect(shouldVoidStaleArchive('not-a-date', now)).toBe(false);
  });
});
