import { describe, expect, it } from 'vitest';
import { formatZhNumber } from './formatters';

describe('formatZhNumber', () => {
  it('formats Chinese locale numbers with independent precision caches', () => {
    expect(formatZhNumber(1234.56)).toBe('1,235');
    expect(formatZhNumber(1234.56, 1)).toBe('1,234.6');
    expect(formatZhNumber(1234.56, 2)).toBe('1,234.56');
    expect(formatZhNumber(1234.56, 1)).toBe('1,234.6');
  });

  it('preserves Intl handling for non-finite numeric values', () => {
    expect(formatZhNumber(Number.NaN, 2)).toBe('NaN');
  });
});
