1
0
mirror of https://github.com/aclindsa/ofxgo.git synced 2024-11-22 03:30:04 -05:00

Add SecurityInfo() and InvPosition() tests.

This commit is contained in:
David Bartley 2023-03-14 18:00:56 -07:00 committed by Aaron Lindsay
parent c2490e1c6a
commit e3c4afc0a3

View File

@ -1866,3 +1866,47 @@ func TestUnmarshalOOList(t *testing.T) {
}
checkEqual(t, "OOList", reflect.ValueOf(&expected), reflect.ValueOf(&actual))
}
func TestSecurityInfo(t *testing.T) {
secInfo := SecInfo{
Ticker: "ABC",
}
tests := []Security{
DebtInfo{SecInfo: secInfo},
MFInfo{SecInfo: secInfo},
OptInfo{SecInfo: secInfo},
OtherInfo{SecInfo: secInfo},
StockInfo{SecInfo: secInfo},
}
for _, tc := range tests {
t.Run(tc.SecurityType(), func(t *testing.T) {
info := tc.SecurityInfo()
if info.Ticker != secInfo.Ticker {
t.Errorf("got %v, want %v", info, secInfo)
}
})
}
}
func TestInvPosition(t *testing.T) {
invPos := InvPosition{
Memo: "stuff",
}
tests := []Position{
DebtPosition{InvPos: invPos},
MFPosition{InvPos: invPos},
OptPosition{InvPos: invPos},
OtherPosition{InvPos: invPos},
StockPosition{InvPos: invPos},
}
for _, tc := range tests {
t.Run(tc.PositionType(), func(t *testing.T) {
pos := tc.InvPosition()
if pos.Memo != invPos.Memo {
t.Errorf("got %v, want %v", pos, invPos)
}
})
}
}