| 771 | } |
| 772 | |
| 773 | func TestTransaction_ToJSON(t *testing.T) { |
| 774 | txn := &Transaction{ |
| 775 | TransactionID: "txn_123", |
| 776 | Amount: 100.50, |
| 777 | Currency: "USD", |
| 778 | Reference: "ref_abc", |
| 779 | Source: "src_123", |
| 780 | Destination: "dst_456", |
| 781 | Status: "APPLIED", |
| 782 | } |
| 783 | |
| 784 | jsonBytes, err := txn.ToJSON() |
| 785 | |
| 786 | assert.NoError(t, err) |
| 787 | assert.NotNil(t, jsonBytes) |
| 788 | assert.Contains(t, string(jsonBytes), "txn_123") |
| 789 | assert.Contains(t, string(jsonBytes), "100.5") |
| 790 | assert.Contains(t, string(jsonBytes), "USD") |
| 791 | } |
| 792 | |
| 793 | func TestPrecisionBankersRound(t *testing.T) { |
| 794 | tests := []struct { |