import { describe, it, expect } from 'vitest';
import { tierRate, tierNum, TIER_THRESHOLDS } from '@domain/value-objects/Tier';

describe('Tier', () => {
  it('tier 1: level 0-40000, rate 10', () => {
    expect(tierRate(0)).toBe(10);
    expect(tierRate(39999)).toBe(10);
    expect(tierRate(40000)).toBe(10);
    expect(tierNum(0)).toBe(1);
    expect(tierNum(40000)).toBe(1);
  });

  it('tier 2: level 40001-70000, rate 20', () => {
    expect(tierRate(40001)).toBe(20);
    expect(tierRate(70000)).toBe(20);
    expect(tierNum(50000)).toBe(2);
  });

  it('tier 3: level 70001-90000, rate 30', () => {
    expect(tierRate(70001)).toBe(30);
    expect(tierRate(90000)).toBe(30);
    expect(tierNum(80000)).toBe(3);
  });

  it('tier 4: level 90001+, rate 40', () => {
    expect(tierRate(90001)).toBe(40);
    expect(tierRate(100000)).toBe(40);
    expect(tierNum(95000)).toBe(4);
  });

  it('TIER_THRESHOLDS has 4 entries', () => {
    expect(TIER_THRESHOLDS).toHaveLength(4);
  });
});
