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

describe('tenureMilestone — copy variants by day count', () => {
  it('0 days reads "Day one."', () => {
    expect(tenureMilestone(0)).toBe('Day one. The team is reading every note you leave.');
  });

  it('1 day reads "Day 2." (off-by-one — day 1 is the first 24h after joining)', () => {
    expect(tenureMilestone(1)).toBe('Day 2. The team is reading every note you leave.');
  });

  it('7 days enters the "{n} days in" bucket', () => {
    expect(tenureMilestone(7)).toBe('7 days in. The team is reading every note you leave.');
  });

  it('22 days reads "A few weeks in."', () => {
    expect(tenureMilestone(22)).toBe('A few weeks in. The team is reading every note you leave.');
  });

  it('60 days reads "{n_months} months in." (months = floor(days/30))', () => {
    expect(tenureMilestone(60)).toBe('2 months in. The team is reading every note you leave.');
  });

  it('200 days reads "Almost a year in." (switches to "Still" suffix)', () => {
    expect(tenureMilestone(200)).toBe('Almost a year in. Still reading every note you leave.');
  });

  it('400 days reads "{n_years} year(s) in."', () => {
    expect(tenureMilestone(400)).toBe('1 year in. Still reading every note you leave.');
    expect(tenureMilestone(730)).toBe('2 years in. Still reading every note you leave.');
  });
});
