Skip to content

Commit

Permalink
Add collectionGuarantees to unit test send-get-block, add signerIds t…
Browse files Browse the repository at this point in the history
…o collection guarantees
  • Loading branch information
jribbink committed May 30, 2022
1 parent f9db53a commit b89b44e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
8 changes: 7 additions & 1 deletion packages/transport-grpc/src/send-get-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,18 @@ function constructResponse(ix, context, res) {
id: u8ToHex(block.getId_asU8(), context),
parentId: u8ToHex(block.getParentId_asU8(), context),
height: block.getHeight(),
timestamp: block.getTimestamp().toDate().toISOString(),
timestamp: block
.getTimestamp()
.toDate()
.toISOString(),
collectionGuarantees: collectionGuarantees.map(collectionGuarantee => ({
collectionId: u8ToHex(
collectionGuarantee.getCollectionId_asU8(),
context
),
signerIds: collectionGuarantee
.getSignerIdsList_asU8()
.map(id => u8ToHex(id, context)),
})),
blockSeals: blockSeals.map(blockSeal => ({
blockId: u8ToHex(blockSeal.getBlockId_asU8(), context),
Expand Down
14 changes: 12 additions & 2 deletions packages/transport-grpc/src/send-get-block.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ describe("Send Get Block", () => {
parentId: "a1b2c3",
height: 123,
timestamp: dateNow.toISOString(),
collectionGuarantees: [],
collectionGuarantees: [
{
collectionId: "abc32111",
signerIds: ["abc32121"],
},
],
blockSeals: [],
}

Expand All @@ -114,7 +119,12 @@ describe("Send Get Block", () => {
toISOString: () => dateNow.toISOString(),
}),
}),
getCollectionGuaranteesList: () => [],
getCollectionGuaranteesList: () => [
{
getCollectionId_asU8: () => hexStrToUInt8Array("abc32111"),
getSignerIdsList_asU8: () => [hexStrToUInt8Array("abc32121")],
},
],
getBlockSealsList: () => [],
getSignaturesList: () => [],
}),
Expand Down

0 comments on commit b89b44e

Please sign in to comment.