Fixed tests and response parser

This commit is contained in:
Riccardo Montagnin 2021-05-27 07:23:59 +02:00 committed by Simon Warta
parent 859b4ec19f
commit 36c7a01e52
2 changed files with 6 additions and 6 deletions

View File

@ -284,10 +284,10 @@ interface RpcBlockId {
function decodeBlockId(data: RpcBlockId): responses.BlockId {
return {
hash: fromHex(assertNotEmpty(data.hash)),
hash: fromHex(data.hash),
parts: {
total: assertNotEmpty(data.parts.total),
hash: fromHex(assertNotEmpty(data.parts.hash)),
total: data.parts.total,
hash: fromHex(data.parts.hash),
},
};
}
@ -349,7 +349,7 @@ function decodeHeader(data: RpcHeader): responses.Header {
validatorsHash: fromHex(assertNotEmpty(data.validators_hash)),
nextValidatorsHash: fromHex(assertNotEmpty(data.next_validators_hash)),
consensusHash: fromHex(assertNotEmpty(data.consensus_hash)),
appHash: fromHex(assertNotEmpty(data.app_hash)),
appHash: fromHex(data.app_hash),
lastResultsHash: fromHex(assertSet(data.last_results_hash)),
evidenceHash: fromHex(assertSet(data.evidence_hash)),

View File

@ -259,8 +259,8 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues)
const query = buildQuery({ raw: "block.height >= 1 AND block.height <= 3" });
const sall = await client.blockSearchAll({ query: query, per_page: 2 });
expect(sall.totalCount).toEqual(5);
expect(sall.blocks.length).toEqual(5);
expect(sall.totalCount).toEqual(3);
expect(sall.blocks.length).toEqual(3);
// make sure there are in order from lowest to highest height
const [b1, b2, b3] = sall.blocks;
expect(b2.block.header.height).toEqual(b1.block.header.height + 1);