better test

master
michael 2022-08-29 01:03:12 +00:00
parent cdd1cb8cc0
commit e8cd7a283d
1 changed files with 9 additions and 10 deletions

View File

@ -10,22 +10,21 @@ func TestBasicFlow(t *testing.T) {
BidDB.Mount()
// add a bid
testBid := &types.Bid{
Owner: "cosmos123",
Amount: "100",
}
if err := BidDB.AddBid("0", testBid); err != nil {
if err := BidDB.AddBid("0", &types.Bid{Owner: "cosmos123", Amount: "100"}); err != nil {
panic(err)
}
// // add a duplicate bid (won't check amount)
// if err := BidDB.AddBid("0", testBid); err != nil {
// panic(err)
// }
// add a higher bid (won't check amount, though)
if err := BidDB.AddBid("0", &types.Bid{Owner: "cosmos456", Amount: "200"}); err != nil {
panic(err)
}
if bid, err := BidDB.GetHighestBid("0"); err != nil {
panic(err)
} else {
panic(bid)
if bid.Owner != "cosmos456" || bid.Amount != "200" {
panic("Highest auction item not selected")
}
}
}