aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/args_test.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-04-02 21:37:35 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-04-02 21:37:35 +0800
commit39085905783829161738207271aa35386f6ebc72 (patch)
treef9d2ecaab503d8703a932f6a6b208fbf334da4f0 /rpc/args_test.go
parent876ce0fb12d7c1eae2907dad9ea13d01e9b3ac17 (diff)
downloaddexon-39085905783829161738207271aa35386f6ebc72.tar
dexon-39085905783829161738207271aa35386f6ebc72.tar.gz
dexon-39085905783829161738207271aa35386f6ebc72.tar.bz2
dexon-39085905783829161738207271aa35386f6ebc72.tar.lz
dexon-39085905783829161738207271aa35386f6ebc72.tar.xz
dexon-39085905783829161738207271aa35386f6ebc72.tar.zst
dexon-39085905783829161738207271aa35386f6ebc72.zip
Make "To" field optional in whisper filter
Diffstat (limited to 'rpc/args_test.go')
-rw-r--r--rpc/args_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/rpc/args_test.go b/rpc/args_test.go
index 0ac8f657b..b88bab280 100644
--- a/rpc/args_test.go
+++ b/rpc/args_test.go
@@ -1805,6 +1805,16 @@ func TestWhisperFilterArgsEmpty(t *testing.T) {
}
}
+func TestWhisperFilterArgsToInt(t *testing.T) {
+ input := `[{"to": 2}]`
+
+ args := new(WhisperFilterArgs)
+ str := ExpectInvalidTypeError(json.Unmarshal([]byte(input), args))
+ if len(str) > 0 {
+ t.Error(str)
+ }
+}
+
func TestWhisperFilterArgsToBool(t *testing.T) {
input := `[{"topics": ["0x68656c6c6f20776f726c64"], "to": false}]`
@@ -1815,6 +1825,21 @@ func TestWhisperFilterArgsToBool(t *testing.T) {
}
}
+func TestWhisperFilterArgsToMissing(t *testing.T) {
+ input := `[{"topics": ["0x68656c6c6f20776f726c64"]}]`
+ expected := new(WhisperFilterArgs)
+ expected.To = ""
+
+ args := new(WhisperFilterArgs)
+ if err := json.Unmarshal([]byte(input), &args); err != nil {
+ t.Error(err)
+ }
+
+ if args.To != expected.To {
+ t.Errorf("To shoud be %v but is %v", expected.To, args.To)
+ }
+}
+
func TestWhisperFilterArgsTopicInt(t *testing.T) {
input := `[{"topics": [6], "to": "0x34ag445g3455b34"}]`