import { render } from '@testing-library/react';
import { describe, expect, it } from 'vitest';

import { ShortScaleNumberDisplay } from './ShortScaleNumberDisplay';

describe('ShortScaleNumberDisplay', () => {
  it('renders correctly for small numbers', () => {
    const { getByText } = render(<ShortScaleNumberDisplay value={10} />);
    expect(getByText('10')).toBeTruthy();
  });

  it('renders correctly for hundreds', () => {
    const { getByText } = render(<ShortScaleNumberDisplay value={100} />);
    expect(getByText('100')).toBeTruthy();
  });

  it('formats thousands to "k" notation', () => {
    const { getByText } = render(<ShortScaleNumberDisplay value={1000} />);
    expect(getByText('1k')).toBeTruthy();
  });

  it('formats ten thousands to "k" notation', () => {
    const { getByText } = render(<ShortScaleNumberDisplay value={10000} />);
    expect(getByText('10k')).toBeTruthy();
  });

  it('formats hundred thousands to "k" notation', () => {
    const { getByText } = render(<ShortScaleNumberDisplay value={100000} />);
    expect(getByText('100k')).toBeTruthy();
  });

  it('formats millions to "m" notation', () => {
    const { getByText } = render(<ShortScaleNumberDisplay value={1000000} />);
    expect(getByText('1m')).toBeTruthy();
  });

  it('formats ten millions to "m" notation', () => {
    const { getByText } = render(<ShortScaleNumberDisplay value={10000000} />);
    expect(getByText('10m')).toBeTruthy();
  });

  it('formats hundred millions to "m" notation', () => {
    const { getByText } = render(<ShortScaleNumberDisplay value={100000000} />);
    expect(getByText('100m')).toBeTruthy();
  });
});
