mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 22:03:36 +00:00
PM-2365 Added a helper function (#6508)
This commit is contained in:
@@ -149,9 +149,7 @@ describe("Cipher Service", () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
configService.checkServerMeetsVersionRequirement$.mockReturnValue(of(false));
|
configService.checkServerMeetsVersionRequirement$.mockReturnValue(of(false));
|
||||||
process.env.FLAGS = JSON.stringify({
|
setEncryptionKeyFlag(false);
|
||||||
enableCipherKeyEncryption: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
const spy = jest.spyOn(cipherFileUploadService, "upload");
|
const spy = jest.spyOn(cipherFileUploadService, "upload");
|
||||||
|
|
||||||
@@ -262,9 +260,7 @@ describe("Cipher Service", () => {
|
|||||||
|
|
||||||
describe("cipher.key", () => {
|
describe("cipher.key", () => {
|
||||||
it("is null when enableCipherKeyEncryption flag is false", async () => {
|
it("is null when enableCipherKeyEncryption flag is false", async () => {
|
||||||
process.env.FLAGS = JSON.stringify({
|
setEncryptionKeyFlag(false);
|
||||||
enableCipherKeyEncryption: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
const cipher = await cipherService.encrypt(cipherView);
|
const cipher = await cipherService.encrypt(cipherView);
|
||||||
|
|
||||||
@@ -272,9 +268,7 @@ describe("Cipher Service", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("is defined when enableCipherKeyEncryption flag is true", async () => {
|
it("is defined when enableCipherKeyEncryption flag is true", async () => {
|
||||||
process.env.FLAGS = JSON.stringify({
|
setEncryptionKeyFlag(true);
|
||||||
enableCipherKeyEncryption: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
const cipher = await cipherService.encrypt(cipherView);
|
const cipher = await cipherService.encrypt(cipherView);
|
||||||
|
|
||||||
@@ -288,9 +282,7 @@ describe("Cipher Service", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("is not called when enableCipherKeyEncryption is false", async () => {
|
it("is not called when enableCipherKeyEncryption is false", async () => {
|
||||||
process.env.FLAGS = JSON.stringify({
|
setEncryptionKeyFlag(false);
|
||||||
enableCipherKeyEncryption: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
await cipherService.encrypt(cipherView);
|
await cipherService.encrypt(cipherView);
|
||||||
|
|
||||||
@@ -298,9 +290,7 @@ describe("Cipher Service", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("is called when enableCipherKeyEncryption is true", async () => {
|
it("is called when enableCipherKeyEncryption is true", async () => {
|
||||||
process.env.FLAGS = JSON.stringify({
|
setEncryptionKeyFlag(true);
|
||||||
enableCipherKeyEncryption: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
await cipherService.encrypt(cipherView);
|
await cipherService.encrypt(cipherView);
|
||||||
|
|
||||||
@@ -309,3 +299,9 @@ describe("Cipher Service", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function setEncryptionKeyFlag(value: boolean) {
|
||||||
|
process.env.FLAGS = JSON.stringify({
|
||||||
|
enableCipherKeyEncryption: value,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user