mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 19:36:44 +01:00
API add bids endpoint
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/base64"
|
||||
"math/big"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
ethCommon "github.com/ethereum/go-ethereum/common"
|
||||
@@ -322,3 +323,22 @@ func TestParseEthAddr(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, ethAddr, *res)
|
||||
}
|
||||
|
||||
func TestParseBidFilters(t *testing.T) {
|
||||
slotNum := "slotNum"
|
||||
bidderAddr := "bidderAddr"
|
||||
slotNumValue := "2"
|
||||
bidderAddrValue := "0xaa942cfcd25ad4d90a62358b0dd84f33b398262a"
|
||||
c := &queryParser{}
|
||||
c.m = make(map[string]string)
|
||||
// Incorrect values
|
||||
c.m[slotNum] = slotNumValue
|
||||
c.m[bidderAddr] = bidderAddrValue
|
||||
|
||||
slotNumParse, bidderAddrParse, err := parseBidFilters(c)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Correct values
|
||||
assert.Equal(t, strings.ToLower(bidderAddrParse.Hex()), bidderAddrValue)
|
||||
assert.Equal(t, slotNumValue, strconv.FormatUint(uint64(*slotNumParse), 10))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user