Skip to content

Commit 7c98db2

Browse files
committed
added test for invalid lenghts
1 parent 839098a commit 7c98db2

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

test/SPVContract.test.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,9 +463,18 @@ describe("SPVContract", () => {
463463
it("should correctly return false when the proof is empty", async () => {
464464
const neededBlockData = getBlockHeaderData(firstBlocksDataFilePath, 1);
465465
const txid = "0x0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098";
466-
const merkleProof: string[] = [];
467466

468-
expect(await spvContract.verifyTx(neededBlockData.blockHash, txid, merkleProof, [])).to.be.false;
467+
expect(await spvContract.verifyTx(neededBlockData.blockHash, txid, [], [])).to.be.false;
468+
});
469+
470+
it("should revert if proof and directions have different lengths", async () => {
471+
const neededBlockData = getBlockHeaderData(firstBlocksDataFilePath, 1);
472+
const txid = "0x0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098";
473+
474+
await expect(spvContract.verifyTx(neededBlockData.blockHash, txid, [], [1])).to.be.revertedWithCustomError(
475+
spvContract,
476+
"InvalidLengths",
477+
);
469478
});
470479

471480
it("should correctly return false when the txid is invalid", async () => {

0 commit comments

Comments
 (0)