import { describe, it, expect } from 'vitest';
import { coverCrop } from './resize';

describe('coverCrop', () => {
  it('crops a landscape image to a centered square', () => {
    expect(coverCrop(200, 100)).toEqual({ sx: 50, sy: 0, s: 100 });
  });
  it('crops a portrait image to a centered square', () => {
    expect(coverCrop(100, 200)).toEqual({ sx: 0, sy: 50, s: 100 });
  });
  it('leaves a square image unchanged', () => {
    expect(coverCrop(120, 120)).toEqual({ sx: 0, sy: 0, s: 120 });
  });
  it('guards degenerate sizes', () => {
    expect(coverCrop(0, 0)).toEqual({ sx: 0, sy: 0, s: 0 });
  });
});
