unit test for new memdb bids getter
parent
a2f5ce1fc1
commit
e5abd3c1d8
|
@ -2,6 +2,7 @@ package memdb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"cosmos-test/x/cosmostest/types"
|
"cosmos-test/x/cosmostest/types"
|
||||||
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/dgraph-io/badger/v3"
|
"github.com/dgraph-io/badger/v3"
|
||||||
|
@ -21,6 +22,18 @@ func TestBasicFlow(t *testing.T) {
|
||||||
panic(err)
|
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
|
// check highest bid
|
||||||
if bid, err := BidDB.GetHighestBid("0"); err != nil {
|
if bid, err := BidDB.GetHighestBid("0"); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
Loading…
Reference in New Issue