Test named exports

This commit is contained in:
dapplion 2020-11-30 11:49:37 +00:00
parent 9b7e5f5f95
commit 2c938ddeed
1 changed files with 21 additions and 0 deletions

View File

@ -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);
}
});