This commit is contained in:
fyears
2021-11-05 01:29:44 +08:00
parent 7c4a981434
commit 774e31ef27
4 changed files with 4 additions and 16 deletions
+3 -8
View File
@@ -1,21 +1,16 @@
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;
global.window = {
crypto: require("crypto").webcrypto,
} 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);
});
});