unit test for new memdb bids getter

master
michael 2022-08-30 21:43:42 +00:00
parent a2f5ce1fc1
commit e5abd3c1d8
1 changed files with 13 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package memdb
import (
"cosmos-test/x/cosmostest/types"
"fmt"
"testing"
"github.com/dgraph-io/badger/v3"
@ -21,6 +22,18 @@ func TestBasicFlow(t *testing.T) {
panic(err)
}
// get all bids out
if bids, err := BidDB.GetBids("0"); err != nil {
panic(err)
} else {
if bids == nil {
panic("GetBids(0) should should not return nil")
}
if len(bids) != 2 {
panic(fmt.Sprintf("Length of GetBids(0) should be 2, instead got %d", len(bids)))
}
}
// check highest bid
if bid, err := BidDB.GetHighestBid("0"); err != nil {
panic(err)