Skip to content

Commit

Permalink
fixup: move utility function into test_fixtures
Browse files Browse the repository at this point in the history
Signed-off-by: 170210 <[email protected]>
  • Loading branch information
170210 committed Aug 23, 2023
1 parent 292513b commit e4d1324
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
19 changes: 1 addition & 18 deletions x/wasm/keeper/msg_server_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ func TestClearAdmin(t *testing.T) {
addr: myAddress.String(),
expErr: false,
expEvents: []abci.Event{
createMsgEvent(myAddress),
types.CreateMsgEvent(myAddress),
{
Type: "update_contract_admin",
Attributes: []abci.EventAttribute{
Expand Down Expand Up @@ -526,20 +526,3 @@ func TestClearAdmin(t *testing.T) {
})
}
}

func createMsgEvent(sender sdk.AccAddress) abci.Event {
// msg event
return abci.Event{
Type: "message",
Attributes: []abci.EventAttribute{
{
Key: []byte("module"),
Value: []byte("wasm"),
},
{
Key: []byte("sender"),
Value: []byte(sender.String()),
},
},
}
}
18 changes: 18 additions & 0 deletions x/wasm/types/test_fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"math/rand"

sdk "github.com/Finschia/finschia-sdk/types"
abci "github.com/tendermint/tendermint/abci/types"
)

func GenesisFixture(mutators ...func(*GenesisState)) GenesisState {
Expand Down Expand Up @@ -329,3 +330,20 @@ func ClearAdminProposalFixture(mutators ...func(p *ClearAdminProposal)) *ClearAd
}
return p
}

// This function is utilized to generate the msg event for event checking in integration tests.
func CreateMsgEvent(sender sdk.AccAddress) abci.Event {
return abci.Event{
Type: "message",
Attributes: []abci.EventAttribute{
{
Key: []byte("module"),
Value: []byte("wasm"),
},
{
Key: []byte("sender"),
Value: []byte(sender.String()),
},
},
}

Check warning on line 348 in x/wasm/types/test_fixtures.go

View check run for this annotation

Codecov / codecov/patch

x/wasm/types/test_fixtures.go#L335-L348

Added lines #L335 - L348 were not covered by tests
}

0 comments on commit e4d1324

Please sign in to comment.