From 2c938ddeed7e61e84cdf78e307631fa166e8c5a7 Mon Sep 17 00:00:00 2001 From: dapplion Date: Mon, 30 Nov 2020 11:49:37 +0000 Subject: [PATCH] Test named exports --- test/unit/index-named-exports.test.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/unit/index-named-exports.test.ts diff --git a/test/unit/index-named-exports.test.ts b/test/unit/index-named-exports.test.ts new file mode 100644 index 0000000..e383ebf --- /dev/null +++ b/test/unit/index-named-exports.test.ts @@ -0,0 +1,21 @@ +import {expect} from "chai"; +import {PrivateKey, PublicKey, Signature, init} from "../../src"; + +describe("index named exports", () => { + it("Classes and methods should be defined", async () => { + await init("herumi"); + + const sk = PrivateKey.fromKeygen(); + const msg = new Uint8Array(32); + const sig = sk.sign(msg); + const pk = sk.toPublicKey(); + expect(verifyHelper(pk, sig, msg)).to.be.true; + }); + + /** + * Sample helper to test argument typing + */ + function verifyHelper(pk: PublicKey, sig: Signature, msg: Uint8Array): boolean { + return sig.verify(pk, msg); + } +});