Additional test about encryption
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "@jest/globals";
|
||||
import { decrypt } from "../../../../../src/core/crypto/index";
|
||||
import { decrypt, encrypt } from "../../../../../src/core/crypto/index";
|
||||
import v2 from "../../../../../src/core/crypto/v2";
|
||||
import v1 from "../../../../../src/core/crypto/v1";
|
||||
import legacy from "../../../../../src/core/crypto/legacy";
|
||||
@@ -29,3 +29,21 @@ describe("Encryption", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Disabled encryption", () => {
|
||||
const encryptionKey = "";
|
||||
|
||||
describe("The encrypt/decrypt functions", () => {
|
||||
it("should not encrypt the data", async () => {
|
||||
const myData = "hello world";
|
||||
|
||||
const encrypted = encrypt(myData, encryptionKey);
|
||||
const decrypted = decrypt(encrypted.data, encryptionKey);
|
||||
const decrypted2 = decrypt(myData, encryptionKey);
|
||||
|
||||
expect(encrypted.data).toBe(myData);
|
||||
expect(decrypted.data).toBe(myData);
|
||||
expect(decrypted2.data).toBe(myData);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user