32 lines
538 B
Go
32 lines
538 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
|
||
|
testBid := &types.Bid{
|
||
|
Owner: "cosmos123",
|
||
|
Amount: "100",
|
||
|
}
|
||
|
if err := BidDB.AddBid("0", testBid); err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
|
||
|
// // add a duplicate bid (won't check amount)
|
||
|
// if err := BidDB.AddBid("0", testBid); err != nil {
|
||
|
// panic(err)
|
||
|
// }
|
||
|
|
||
|
if bid, err := BidDB.GetHighestBid("0"); err != nil {
|
||
|
panic(err)
|
||
|
} else {
|
||
|
panic(bid)
|
||
|
}
|
||
|
}
|