Skip to content

Commit

Permalink
refactor: remove asset events legacy and events map
Browse files Browse the repository at this point in the history
  • Loading branch information
akaladarshi committed Mar 28, 2024
1 parent d487038 commit f29b72f
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions testing/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import (
channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
)

type EventsMap map[string]map[string]string

// ParseClientIDFromEvents parses events emitted from a MsgCreateClient and returns the
// client identifier.
func ParseClientIDFromEvents(events []abci.Event) (string, error) {
Expand Down Expand Up @@ -167,36 +165,6 @@ func ParseProposalIDFromEvents(events []abci.Event) (uint64, error) {
return 0, fmt.Errorf("proposalID event attribute not found")
}

// AssertEventsLegacy asserts that expected events are present in the actual events.
// Expected map needs to be a subset of actual events to pass.
func AssertEventsLegacy(
suite *testifysuite.Suite,
expected EventsMap,
actual []abci.Event,
) {
hasEvents := make(map[string]bool)
for eventType := range expected {
hasEvents[eventType] = false
}

for _, event := range actual {
expEvent, eventFound := expected[event.Type]
if eventFound {
hasEvents[event.Type] = true
suite.Require().Len(event.Attributes, len(expEvent))
for _, attr := range event.Attributes {
expValue, found := expEvent[attr.Key]
suite.Require().True(found)
suite.Require().Equal(expValue, attr.Value)
}
}
}

for eventName, hasEvent := range hasEvents {
suite.Require().True(hasEvent, "event: %s was not found in events", eventName)
}
}

// AssertEvents asserts that expected events are present in the actual events.
func AssertEvents(
suite *testifysuite.Suite,
Expand Down

0 comments on commit f29b72f

Please sign in to comment.