Skip to content

Commit

Permalink
add test for empty chain name
Browse files Browse the repository at this point in the history
  • Loading branch information
haiyizxx committed Sep 25, 2024
1 parent fedb6f4 commit bf3ae75
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/wasm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,18 @@ func TestQueryPlugins(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, fmt.Sprintf("{\"tx_hash\":%s,\"nonce\":%d}", funcs.Must(json.Marshal(txHash)), index), string(actual))
}),
When("request is a nexus wasm IsChainRegistered query with empty chain name", func() {
req = []byte("{\"nexus\":{\"is_chain_registered\":{\"chain\": \"\"}}}")
}).
Then("should fail validation", func(t *testing.T) {
nexusK.GetChainFunc = func(ctx sdk.Context, chain nexus.ChainName) (nexus.Chain, bool) {
return nexus.Chain{}, true
}

_, err := app.NewQueryPlugins(nexusK).Custom(ctx, req)

assert.ErrorContains(t, err, "invalid chain name")
}),
When("request is a nexus wasm IsChainRegistered query", func() {
req = []byte("{\"nexus\":{\"is_chain_registered\":{\"chain\": \"chain-0\"}}}")
}).
Expand Down

0 comments on commit bf3ae75

Please sign in to comment.