From 1c883cc81965d891b089f2d3a13ec613245ce712 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 26 Nov 2019 13:24:49 +0300 Subject: [PATCH] rpc: add invokescript tests --- pkg/rpc/server_test.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/pkg/rpc/server_test.go b/pkg/rpc/server_test.go index 48568b805..1916617a5 100644 --- a/pkg/rpc/server_test.go +++ b/pkg/rpc/server_test.go @@ -280,6 +280,35 @@ var rpcTestCases = map[string][]rpcTestCase{ fail: true, }, }, + "invokescript": { + { + name: "positive", + params: `["51c56b0d48656c6c6f2c20776f726c6421680f4e656f2e52756e74696d652e4c6f67616c7566"]`, + result: func(e *executor) interface{} { return &InvokeFunctionResponse{} }, + check: func(t *testing.T, e *executor, result interface{}) { + res, ok := result.(*InvokeFunctionResponse) + require.True(t, ok) + assert.NotEqual(t, "", res.Result.Script) + assert.NotEqual(t, "", res.Result.State) + assert.NotEqual(t, 0, res.Result.GasConsumed) + }, + }, + { + name: "no params", + params: `[]`, + fail: true, + }, + { + name: "not a string", + params: `[42]`, + fail: true, + }, + { + name: "bas string", + params: `["qwerty"]`, + fail: true, + }, + }, "sendrawtransaction": { { name: "positive",