Skip to content

Tests/gossip#515

Open
evgensheff wants to merge 5 commits intoFantom-foundation:developfrom
evgensheff:tests/gossip
Open

Tests/gossip#515
evgensheff wants to merge 5 commits intoFantom-foundation:developfrom
evgensheff:tests/gossip

Conversation

@evgensheff
Copy link

Unit test to raise gossip test coverage

@evgensheff evgensheff requested a review from rus-alex October 4, 2023 12:13
"testing"

"github.com/ethereum/go-ethereum/core/types"
"github.com/stretchr/testify/assert"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be better to use "github.com/stretchr/testify/require" instead, for uniformity purpose.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense, changed

store.SetTx(tx.Hash(), tx)

txFromStore := store.GetTx(tx.Hash())
assert.Equal(t, tx.Data(), txFromStore.Data())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about comparing of the rest of tx's public fields?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, added

em.quorumIndexer = nil
em.fcIndexer = ancestor.NewFCIndexer(newValidators, em.world.DagIndex(), em.config.Validator.ID)

em.buildSearchStrategies(idx.Event(4))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if the returned value is equal to expected.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

})

t.Run("choose parent not selfParent", func(t *testing.T) {
em.chooseParents(idx.Epoch(1), em.config.Validator.ID)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if the returned value is equal to expected.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants