gpu-compute-chain/x/cosmostest/memdb/biddb_test.go

31 lines
633 B
Go

package memdb
import (
"cosmos-test/x/cosmostest/types"
"testing"
)
func TestBasicFlow(t *testing.T) {
// this should panic if there's a problem
BidDB.Mount()
// add a bid
if err := BidDB.AddBid("0", &types.Bid{Owner: "cosmos123", Amount: "100"}); 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 {
if bid.Owner != "cosmos456" || bid.Amount != "200" {
panic("Highest auction item not selected")
}
}
}