allow tests

This commit is contained in:
fyears
2021-11-05 01:21:58 +08:00
parent 358311e8ac
commit 7c4a981434
4 changed files with 36 additions and 2 deletions
+21
View File
@@ -0,0 +1,21 @@
const webcrypto = require("crypto").webcrypto;
import { expect } from "chai";
import { encryptStringToBase32 } from "../src/encrypt";
describe("Encryption tests", () => {
beforeEach(function () {
const window = {
crypto: webcrypto,
};
global.window = window as any;
});
it("should encrypt string", async () => {
const k = "dkjdhkfhdkjgsdklxxd";
const password = "hey";
//console.log(window.crypto.getRandomValues)
expect(await encryptStringToBase32(k, password)).to.not.equal(k);
});
});