Add Bite integration test

This commit is contained in:
Rob Mulholand
2018-10-19 14:21:57 -05:00
parent ddc7ee5143
commit 0ce3e3d829
4 changed files with 71 additions and 9 deletions
+3 -2
View File
@@ -17,6 +17,7 @@
package bite
import (
"bytes"
"encoding/json"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
@@ -61,8 +62,8 @@ func (BiteConverter) ToEntities(contractAbi string, ethLogs []types.Log) ([]Bite
func (converter BiteConverter) ToModels(entities []BiteEntity) ([]BiteModel, error) {
var models []BiteModel
for _, entity := range entities {
ilk := common.BytesToAddress(entity.Ilk[:common.AddressLength]).String()
urn := common.BytesToAddress(entity.Urn[:common.AddressLength]).String()
ilk := string(bytes.Trim(entity.Ilk[:], "\x00"))
urn := common.BytesToAddress(entity.Urn[:]).String()
ink := entity.Ink
art := entity.Art
iArt := entity.IArt
+1 -1
View File
@@ -71,7 +71,7 @@ var _ = Describe("Bite Converter", func() {
emptyLog, err := json.Marshal(types.Log{})
Expect(err).NotTo(HaveOccurred())
expectedModel := bite.BiteModel{
Ilk: "0x0000000000000000000000000000000000000000",
Ilk: "",
Urn: "0x0000000000000000000000000000000000000000",
Ink: "",
Art: "",