From 42f3bcef14fecef90583b1caeface3010c6054e6 Mon Sep 17 00:00:00 2001 From: dancoffman Date: Tue, 13 Dec 2022 11:24:55 -0800 Subject: [PATCH] Actually test --- bindings/node.js/test.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/bindings/node.js/test.ts b/bindings/node.js/test.ts index bffe113..e29be4e 100644 --- a/bindings/node.js/test.ts +++ b/bindings/node.js/test.ts @@ -69,7 +69,7 @@ describe("C-KZG", () => { ); }); - it("verifies an invalid KZG proof without crashing", () => { + it("verifies a valid KZG proof", () => { const commitment = new Uint8Array(48).fill(0); commitment[0] = 0xc0; const z = new Uint8Array(32).fill(0); @@ -77,7 +77,18 @@ describe("C-KZG", () => { const proof = new Uint8Array(48).fill(0); proof[0] = 0xc0; - verifyKzgProof(commitment, z, y, proof); + expect(verifyKzgProof(commitment, z, y, proof)).toBe(true); + }); + + it("verifies an invalid valid KZG proof", () => { + const commitment = new Uint8Array(48).fill(0); + commitment[0] = 0xc0; + const z = new Uint8Array(32).fill(1); + const y = new Uint8Array(32).fill(1); + const proof = new Uint8Array(48).fill(0); + proof[0] = 0xc0; + + expect(verifyKzgProof(commitment, z, y, proof)).toBe(false); }); it("computes the aggregate proof when for a single blob", () => {