Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
Open sidebar
Tiger Ton
osmosis
Commits
ae15972a
Commit
ae15972a
authored
2 years ago
by
Nicolas Lara
Browse files
Options
Download
Email Patches
Plain Diff
added missing helpers
parent
a800e9b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/apptesting/events.go
+17
-1
app/apptesting/events.go
with
17 additions
and
1 deletion
+17
-1
app/apptesting/events.go
+
17
-
1
View file @
ae15972a
package
apptesting
import
sdk
"github.com/cosmos/cosmos-sdk/types"
import
(
sdk
"github.com/cosmos/cosmos-sdk/types"
"golang.org/x/exp/slices"
)
// AssertEventEmitted asserts that ctx's event manager has emitted the given number of events
// of the given type.
...
...
@@ -15,3 +18,16 @@ func (s *KeeperTestHelper) AssertEventEmitted(ctx sdk.Context, eventTypeExpected
}
s
.
Equal
(
numEventsExpected
,
len
(
actualEvents
))
}
func
(
s
*
KeeperTestHelper
)
FindEvent
(
events
[]
sdk
.
Event
,
name
string
)
sdk
.
Event
{
index
:=
slices
.
IndexFunc
(
events
,
func
(
e
sdk
.
Event
)
bool
{
return
e
.
Type
==
name
})
return
events
[
index
]
}
func
(
s
*
KeeperTestHelper
)
ExtractAttributes
(
event
sdk
.
Event
)
map
[
string
]
string
{
attrs
:=
make
(
map
[
string
]
string
)
for
_
,
a
:=
range
event
.
Attributes
{
attrs
[
string
(
a
.
Key
)]
=
string
(
a
.
Value
)
}
return
attrs
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment