Skip to content

Commit

Permalink
Fix test structures (TODO: fix tests themselves)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaptic committed Sep 8, 2022
1 parent e860ddb commit 0a2975c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
19 changes: 11 additions & 8 deletions exp/lighthorizon/adapters/transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/stellar/go/exp/lighthorizon/common"
"github.com/stellar/go/exp/lighthorizon/ingester"
"github.com/stellar/go/ingest"
"github.com/stellar/go/network"
protocol "github.com/stellar/go/protocols/horizon"
Expand Down Expand Up @@ -52,15 +53,17 @@ func TestTransactionAdapter(t *testing.T) {
closeTimestamp := expectedTx.LedgerCloseTime.UTC().Unix()

tx := common.Transaction{
LedgerTransaction: &ingest.LedgerTransaction{
Index: 0,
Envelope: txEnv,
Result: xdr.TransactionResultPair{
TransactionHash: xdr.Hash{},
Result: txResult,
LedgerTransaction: &ingester.LedgerTransaction{
LedgerTransaction: &ingest.LedgerTransaction{
Index: 0,
Envelope: txEnv,
Result: xdr.TransactionResultPair{
TransactionHash: xdr.Hash{},
Result: txResult,
},
FeeChanges: txFeeMeta,
UnsafeMeta: txMeta,
},
FeeChanges: txFeeMeta,
UnsafeMeta: txMeta,
},
LedgerHeader: &xdr.LedgerHeader{
LedgerSeq: xdr.Uint32(expectedTx.Ledger),
Expand Down
6 changes: 6 additions & 0 deletions exp/lighthorizon/ingester/mock_ingester.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ingester
import (
"context"

"github.com/stellar/go/historyarchive"
"github.com/stellar/go/xdr"
"github.com/stretchr/testify/mock"
)
Expand All @@ -28,6 +29,11 @@ func (m *MockIngester) GetLedger(ctx context.Context, sequence uint32) (xdr.Seri
return args.Get(0).(xdr.SerializedLedgerCloseMeta), args.Error(1)
}

func (m *MockIngester) PrepareRange(ctx context.Context, r historyarchive.Range) error {
args := m.Called(ctx, r)
return args.Error(0)
}

type MockLedgerTransactionReader struct {
mock.Mock
}
Expand Down

0 comments on commit 0a2975c

Please sign in to comment.