Skip to content

Commit

Permalink
add more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
NotJeremyLiu committed Dec 27, 2023
1 parent e405904 commit 7d5c13b
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions x/wasm/keeper/querier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,42 @@ func TestQueryBuildAddress(t *testing.T) {
src: nil,
expErr: status.Error(codes.InvalidArgument, "empty request"),
},
"invalid code hash": {
src: &types.QueryBuildAddressRequest{
CodeHash: "invalid",
CreatorAddress: "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
Salt: "61",
InitArgs: nil,
},
expErr: fmt.Errorf("invalid code hash"),
},
"invalid creator address": {
src: &types.QueryBuildAddressRequest{
CodeHash: "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5",
CreatorAddress: "invalid",
Salt: "61",
InitArgs: nil,
},
expErr: fmt.Errorf("invalid creator address"),
},
"invalid salt": {
src: &types.QueryBuildAddressRequest{
CodeHash: "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5",
CreatorAddress: "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
Salt: "invalid",
InitArgs: nil,
},
expErr: fmt.Errorf("invalid salt"),
},
"empty salt": {
src: &types.QueryBuildAddressRequest{
CodeHash: "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5",
CreatorAddress: "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
Salt: "",
InitArgs: nil,
},
expErr: status.Error(codes.InvalidArgument, "empty salt"),
},
"valid - without init args": {
src: &types.QueryBuildAddressRequest{
CodeHash: "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5",
Expand Down

0 comments on commit 7d5c13b

Please sign in to comment.