1
0
mirror of https://github.com/aclindsa/ofxgo.git synced 2025-08-02 07:15:18 -04:00

Add InvTransaction() method to InvTransaction interface.

This commit is contained in:
David Bartley
2024-04-06 23:20:37 -07:00
committed by Aaron Lindsay
parent 4f2c5582d1
commit d31ac10d08
2 changed files with 120 additions and 1 deletions

View File

@@ -1,11 +1,12 @@
package ofxgo
import (
"github.com/aclindsa/xml"
"reflect"
"strings"
"testing"
"time"
"github.com/aclindsa/xml"
)
func TestMarshalInvStatementRequest(t *testing.T) {
@@ -1910,3 +1911,40 @@ func TestInvPosition(t *testing.T) {
})
}
}
func TestInvTransaction(t *testing.T) {
invTran := InvTran{
Memo: "stuff",
}
tests := []InvTransaction{
BuyDebt{InvBuy: InvBuy{InvTran: invTran}},
BuyMF{InvBuy: InvBuy{InvTran: invTran}},
BuyOpt{InvBuy: InvBuy{InvTran: invTran}},
BuyOther{InvBuy: InvBuy{InvTran: invTran}},
BuyStock{InvBuy: InvBuy{InvTran: invTran}},
ClosureOpt{InvTran: invTran},
Income{InvTran: invTran},
InvExpense{InvTran: invTran},
JrnlFund{InvTran: invTran},
JrnlSec{InvTran: invTran},
MarginInterest{InvTran: invTran},
Reinvest{InvTran: invTran},
RetOfCap{InvTran: invTran},
SellDebt{InvSell: InvSell{InvTran: invTran}},
SellMF{InvSell: InvSell{InvTran: invTran}},
SellOpt{InvSell: InvSell{InvTran: invTran}},
SellOther{InvSell: InvSell{InvTran: invTran}},
SellStock{InvSell: InvSell{InvTran: invTran}},
Split{InvTran: invTran},
Transfer{InvTran: invTran},
}
for _, tc := range tests {
t.Run(tc.TransactionType(), func(t *testing.T) {
tran := tc.InvTransaction()
if tran.Memo != invTran.Memo {
t.Errorf("got %v, want %v", tran, invTran)
}
})
}
}