Skip to content

Commit

Permalink
add test for removing non-existent tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
kingpinXD committed Nov 28, 2024
1 parent 5eb1127 commit 091ec82
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions x/crosschain/keeper/outbound_tracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,29 @@ func TestOutboundTrackerGet(t *testing.T) {
}
}
func TestOutboundTrackerRemove(t *testing.T) {
k, ctx, _, _ := keepertest.CrosschainKeeper(t)
items := createNOutboundTracker(k, ctx, 10)
for _, item := range items {
k.RemoveOutboundTrackerFromStore(ctx,
item.ChainId,
item.Nonce,
)
_, found := k.GetOutboundTracker(ctx,
item.ChainId,
item.Nonce,
)
require.False(t, found)
}
t.Run("Remove tracker if it exists", func(t *testing.T) {
keeper, ctx, _, _ := keepertest.CrosschainKeeper(t)
items := createNOutboundTracker(keeper, ctx, 10)
for _, item := range items {
keeper.RemoveOutboundTrackerFromStore(ctx,
item.ChainId,
item.Nonce,
)
_, found := keeper.GetOutboundTracker(ctx,
item.ChainId,
item.Nonce,
)
require.False(t, found)
}
})

t.Run("Do nothing if tracker doesn't exist", func(t *testing.T) {
keeper, ctx, _, _ := keepertest.CrosschainKeeper(t)
require.NotPanics(t, func() {
keeper.RemoveOutboundTrackerFromStore(ctx, 1, 1)
})
})

}

func TestOutboundTrackerGetAll(t *testing.T) {
Expand Down

0 comments on commit 091ec82

Please sign in to comment.