import { describe, it, expect } from 'vitest';
import { voteCountSentence } from '../src/lib/format.js';

describe('voteCountSentence — denominator pluralisation', () => {
  it('reads correctly for a council of 0 (defensive — should never ship)', () => {
    expect(voteCountSentence(0, 0)).toBe('0 of 0 council members have weighed in.');
  });

  it('uses singular "member has" when the council has exactly 1 member', () => {
    expect(voteCountSentence(0, 1)).toBe('0 of 1 council member has weighed in.');
    expect(voteCountSentence(1, 1)).toBe('1 of 1 council member has weighed in.');
  });

  it('uses plural "members have" for a council of 5', () => {
    expect(voteCountSentence(0, 5)).toBe('0 of 5 council members have weighed in.');
    expect(voteCountSentence(2, 5)).toBe('2 of 5 council members have weighed in.');
    expect(voteCountSentence(5, 5)).toBe('5 of 5 council members have weighed in.');
  });
});
