mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
graphql: test case
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
eee6dfc9f1
commit
ba409e2e49
3 changed files with 3 additions and 2 deletions
|
|
@ -25,6 +25,7 @@ var (
|
|||
errOnlyNumberOrHash = invalidParamsError("only one of number or hash must be specified")
|
||||
errBlockInvariant = invalidParamsError("block objects must be instantiated with at least one of num or hash")
|
||||
errInvalidBlockRange = invalidParamsError("invalid from and to block combination: from > to")
|
||||
errFromBlockRequired = invalidParamsError("from block number must be specified")
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
|||
|
|
@ -1320,7 +1320,7 @@ func (r *Resolver) Blocks(ctx context.Context, args struct {
|
|||
To *Long
|
||||
}) ([]*Block, error) {
|
||||
if args.From == nil {
|
||||
return nil, errors.New("from block number must be specified")
|
||||
return nil, errFromBlockRequired
|
||||
}
|
||||
from := rpc.BlockNumber(*args.From)
|
||||
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ func TestGraphQLBlockSerialization(t *testing.T) {
|
|||
},
|
||||
{
|
||||
body: `{"query": "{blocks {number}}"}`,
|
||||
want: `{"errors":[{"message":"from block number must be specified","path":["blocks"]}],"data":null}`,
|
||||
want: `{"errors":[{"message":"error [-32602]: from block number must be specified","path":["blocks"],"extensions":{"errorCode":-32602,"errorMessage":"from block number must be specified"}}],"data":null}`,
|
||||
code: 400,
|
||||
},
|
||||
// invalid block range
|
||||
|
|
|
|||
Loading…
Reference in a new issue