diff --git a/lib/tests/test_util.py b/lib/tests/test_util.py new file mode 100644 index 000000000..f0da88be7 --- /dev/null +++ b/lib/tests/test_util.py @@ -0,0 +1,19 @@ +import unittest +from lib.util import format_satoshis + +class TestUtil(unittest.TestCase): + + def test_format_satoshis(self): + result = format_satoshis(1234) + expected = "0.00001234" + self.assertEqual(expected, result) + + def test_format_satoshis_diff_positive(self): + result = format_satoshis(1234, is_diff=True) + expected = "+0.00001234" + self.assertEqual(expected, result) + + def test_format_satoshis_diff_negative(self): + result = format_satoshis(-1234, is_diff=True) + expected = "-0.00001234" + self.assertEqual(expected, result)