import { describe, it, expect } from 'vitest';
import { Money } from '../value-objects/money.vo';

describe('Money Value Object', () => {
  it('should create a valid money amount', () => {
    const result = Money.create(100_000n);
    expect(result.isOk).toBe(true);
    expect(result.unwrap().value).toBe(100_000n);
  });

  it('should reject zero amount', () => {
    const result = Money.create(0n);
    expect(result.isErr).toBe(true);
    expect(result.unwrapErr()).toContain('lớn hơn 0');
  });

  it('should reject negative amount', () => {
    const result = Money.create(-100n);
    expect(result.isErr).toBe(true);
  });

  it('should reject amount exceeding limit', () => {
    const result = Money.create(1_000_000_000_000n);
    expect(result.isErr).toBe(true);
    expect(result.unwrapErr()).toContain('giới hạn');
  });

  it('should accept max valid amount', () => {
    const result = Money.create(999_999_999_999n);
    expect(result.isOk).toBe(true);
  });
});
