Skip to content

Commit

Permalink
Add SecurityInfo() and InvPosition() tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
dtbartle authored and aclindsa committed Mar 15, 2023
1 parent c2490e1 commit e3c4afc
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions invstmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
})
}
}

0 comments on commit e3c4afc

Please sign in to comment.