import { describe, it, expect } from 'vitest';
import { formatVND, formatVNDCompact, parseVND } from '../currency.formatter';

describe('formatVND', () => {
  it('should format VND amount', () => {
    const result = formatVND(1500000);
    expect(result).toMatch(/1[.,]500[.,]000/);
    expect(result).toContain('₫');
  });

  it('should format zero', () => {
    const result = formatVND(0);
    expect(result).toContain('0');
  });
});

describe('formatVNDCompact', () => {
  it('should format large amounts compactly', () => {
    const result = formatVNDCompact(1500000000);
    expect(result.length).toBeLessThan(20);
  });
});

describe('parseVND', () => {
  it('should parse numeric string', () => {
    expect(parseVND('1.500.000 ₫')).toBe(1500000);
  });

  it('should return null for non-numeric', () => {
    expect(parseVND('')).toBeNull();
  });
});
