From c4f43465fabfcd0e75217d4e44ddaaba3610253f Mon Sep 17 00:00:00 2001
From: Moul <moul@moul.re>
Date: Mon, 24 Jun 2019 19:58:43 +0100
Subject: [PATCH] [test] #233: Test passed values to transaction_amount()

---
 tests/test_tx.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 tests/test_tx.py

diff --git a/tests/test_tx.py b/tests/test_tx.py
new file mode 100644
index 00000000..63dc6f99
--- /dev/null
+++ b/tests/test_tx.py
@@ -0,0 +1,19 @@
+import pytest
+from silkaj.tx import transaction_amount
+from silkaj.money import UDValue
+
+
+@pytest.mark.asyncio
+async def test_transaction_amount():
+    """test passed amounts passed tx command
+    float ≠ 100 does not give the exact value"""
+
+    assert await transaction_amount(141.89, None, None) == 14189
+    assert await transaction_amount(141.99, None, None) == 14199
+    assert await transaction_amount(141.01, None, None) == 14101
+
+    ud_value = await UDValue().ud_value
+    assert await transaction_amount(None, 1.1, None) == round(1.1 * ud_value)
+    assert await transaction_amount(None, 1.9, None) == round(1.9 * ud_value)
+    assert await transaction_amount(None, 1.0001, None) == round(1.0001 * ud_value)
+    assert await transaction_amount(None, 9.9999, None) == round(9.9999 * ud_value)
-- 
GitLab