Skip to content

Commit

Permalink
positive test
Browse files Browse the repository at this point in the history
  • Loading branch information
miiu96 committed Dec 9, 2020
1 parent 45ffaad commit 6852fc3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
7 changes: 5 additions & 2 deletions process/accountProcessor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func TestAccountProcessor_GetShardIDForAddressShouldError(t *testing.T) {
assert.Equal(t, expectedError, err)
}

func TestAccountProcessor_GetTransactionsInvalidAddrShouldErr(t *testing.T) {
func TestAccountProcessor_GetTransactions(t *testing.T) {
t.Parallel()

converter, _ := factory.NewPubkeyConverter(config.PubkeyConfig{
Expand All @@ -294,12 +294,15 @@ func TestAccountProcessor_GetTransactionsInvalidAddrShouldErr(t *testing.T) {
ap, _ := process.NewAccountProcessor(
&mock.ProcessorStub{},
converter,
database.NewDisabledElasticSearchConnector(),
&mock.ElasticSearchConnectorMock{},
)

_, err := ap.GetTransactions("invalidAddress")
assert.True(t, errors.Is(err, process.ErrInvalidAddress))

_, err = ap.GetTransactions("")
assert.True(t, errors.Is(err, process.ErrInvalidAddress))

_, err = ap.GetTransactions("erd1ycega644rvjtgtyd8hfzt6hl5ymaa8ml2nhhs5cv045cz5vxm00q022myr")
assert.Nil(t, err)
}
21 changes: 21 additions & 0 deletions process/mock/elasticSearchConnectorMock.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package mock

import "github.com/ElrondNetwork/elrond-proxy-go/data"

type ElasticSearchConnectorMock struct {
}

// GetTransactionsByAddress -
func (escm *ElasticSearchConnectorMock) GetTransactionsByAddress(_ string) ([]data.DatabaseTransaction, error) {
return nil, nil
}

// GetAtlasBlockByShardIDAndNonce -
func (escm *ElasticSearchConnectorMock) GetAtlasBlockByShardIDAndNonce(_ uint32, _ uint64) (data.AtlasBlock, error) {
return data.AtlasBlock{}, nil
}

// IsInterfaceNil -
func (escm *ElasticSearchConnectorMock) IsInterfaceNil() bool {
return escm == nil
}

0 comments on commit 6852fc3

Please sign in to comment.