Skip to content

Commit

Permalink
Add validateAddress test
Browse files Browse the repository at this point in the history
  • Loading branch information
chipshort committed Feb 26, 2024
1 parent f41bb6f commit 8607164
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions x/wasm/keeper/api_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package keeper

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestValidateAddress(t *testing.T) {
specs := map[string]struct {
human string
valid bool
}{
"valid address": {
human: RandomBech32AccountAddress(t),
valid: true,
},
"invalid address": {
human: "cosmos1invalid",
valid: false,
},
}
for name, spec := range specs {
t.Run(name, func(t *testing.T) {
_, err := validateAddress(spec.human)

if spec.valid {
require.NoError(t, err)
} else {
require.Error(t, err)
}
})
}
}

0 comments on commit 8607164

Please sign in to comment.