asxpio/test/fmt_test.rb
Sergei Poljanski f7319a08a9
All checks were successful
Build and Deploy to Production / test (push) Successful in 2m28s
Build and Deploy to Production / build (push) Successful in 52s
Build and Deploy to Production / deploy (push) Successful in 30s
fmt: shared number formatting for HTML and PDF
2026-07-02 18:40:20 +04:00

22 lines
558 B
Ruby

require_relative 'test_helper'
class FmtTest < Minitest::Test
def test_rate_pads_to_min_dp
assert_equal '2.9500', Fmt.rate('2.95')
assert_equal '3.0000', Fmt.rate(3)
end
def test_rate_keeps_captured_precision
assert_equal '2.95123456', Fmt.rate('2.95123456')
end
def test_rate_groups_thousands
assert_equal '1,050.2500', Fmt.rate('1050.25')
end
def test_ltc_trims_trailing_zeros
assert_equal '1.25', Fmt.ltc('1.250000')
assert_equal '2', Fmt.ltc('2.0')
assert_equal '0.00123456', Fmt.ltc('0.00123456')
end
end