Skip to content

Commit

Permalink
add test for encodeRecord with dynamic data
Browse files Browse the repository at this point in the history
  • Loading branch information
alvrs committed Jul 3, 2023
1 parent 70f1be8 commit 2f9ad25
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/protocol-parser/src/encodeRecord.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,10 @@ describe("encodeRecord", () => {
"0x0000000100000000000000000000000000000002000000000000130000000008000000000b0000000000000000000000000000000000000300000004736f6d6520737472696e67"
);
});

it("should not include the packed dynamic lengths if there are no dynamic fields", () => {
const schema = { staticFields: ["uint32", "uint128"], dynamicFields: [] } as const;
const hex = encodeRecord(schema, [1, 2n]);
expect(hex).toBe("0x0000000100000000000000000000000000000002");
});
});

0 comments on commit 2f9ad25

Please sign in to comment.