diff --git a/x/wasm/keeper/events_test.go b/x/wasm/keeper/events_test.go index 95ffd15fcc..3c55a60878 100644 --- a/x/wasm/keeper/events_test.go +++ b/x/wasm/keeper/events_test.go @@ -106,6 +106,23 @@ func TestNewCustomEvents(t *testing.T) { exp: sdk.Events{sdk.NewEvent("wasm-foo", sdk.NewAttribute("_contract_address", myContract.String()))}, }, + "empty value can be solved": { + src: wasmvmtypes.Events{{ + Type: "foo", + Attributes: []wasmvmtypes.EventAttribute{{Key: "myKey", Value: ""}}, + }}, + exp: sdk.Events{sdk.NewEvent("wasm-foo", + sdk.NewAttribute("_contract_address", myContract.String()), + sdk.NewAttribute("myKey", ""))}, + }, + "good on whitespace value": { + src: wasmvmtypes.Events{{ + Type: "foo", + Attributes: []wasmvmtypes.EventAttribute{{Key: "myKey", Value: "\n\n\n"}}, + }}, exp: sdk.Events{sdk.NewEvent("wasm-foo", + sdk.NewAttribute("_contract_address", myContract.String()), + sdk.NewAttribute("myKey", ""))}, + }, "error on short event type": { src: wasmvmtypes.Events{{ Type: "f", @@ -158,16 +175,6 @@ func TestNewCustomEvents(t *testing.T) { }}, isError: true, }, - "error on only whitespace value": { - src: wasmvmtypes.Events{{ - Type: "boom", - Attributes: []wasmvmtypes.EventAttribute{ - {Key: "some", Value: "data"}, - {Key: "myKey", Value: " \t\r\n"}, - }, - }}, - isError: true, - }, "strip out whitespace": { src: wasmvmtypes.Events{{ Type: " food\n", @@ -233,10 +240,6 @@ func TestNewWasmModuleEvent(t *testing.T) { src: []wasmvmtypes.EventAttribute{{Key: " ", Value: "value"}}, isError: true, }, - "error on whitespace value": { - src: []wasmvmtypes.EventAttribute{{Key: "key", Value: "\n\n\n"}}, - isError: true, - }, "strip whitespace": { src: []wasmvmtypes.EventAttribute{{Key: " my-real-key ", Value: "\n\n\nsome-val\t\t\t"}}, exp: sdk.Events{sdk.NewEvent("wasm",