mirror of
https://github.com/bitwarden/browser
synced 2026-02-17 09:59:41 +00:00
Fix tests
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
// FIXME: Update this file to be type safe and remove this and next line
|
||||
// @ts-strict-ignore
|
||||
import { mock, MockProxy } from "jest-mock-extended";
|
||||
import { of } from "rxjs";
|
||||
|
||||
import { ContainerService } from "@bitwarden/common/platform/services/container.service";
|
||||
import { KeyService } from "@bitwarden/key-management";
|
||||
@@ -87,6 +86,6 @@ export const mockContainerService = () => {
|
||||
const encryptService = mock<EncryptService>();
|
||||
(window as any).bitwardenContainerService = new ContainerService(keyService, encryptService);
|
||||
return (window as any).bitwardenContainerService;
|
||||
}
|
||||
};
|
||||
|
||||
export { trackEmissions, awaitAsync } from "@bitwarden/core-test-utils";
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
import { of } from "rxjs";
|
||||
|
||||
import mock from "@bitwarden/common/platform/spec/mock-deep";
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { KeyService } from "@bitwarden/key-management";
|
||||
|
||||
import { makeSymmetricCryptoKey, mockContainerService, mockEnc } from "../../../../../spec";
|
||||
import { EncryptService } from "../../../../key-management/crypto/abstractions/encrypt.service";
|
||||
import { ContainerService } from "../../../../platform/services/container.service";
|
||||
import { SendFileData } from "../data/send-file.data";
|
||||
|
||||
import { SendFile } from "./send-file";
|
||||
@@ -49,8 +43,7 @@ describe("SendFile", () => {
|
||||
it("Decrypt", async () => {
|
||||
const containerService = mockContainerService();
|
||||
containerService.getKeyService().userKey$.mockReturnValue(of(makeSymmetricCryptoKey(64)));
|
||||
containerService.getEncryptService()
|
||||
.decryptString.mockResolvedValue("fileName");
|
||||
containerService.getEncryptService().decryptString.mockResolvedValue("fileName");
|
||||
|
||||
const sendFile = new SendFile();
|
||||
sendFile.id = "id";
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
import { of } from "rxjs";
|
||||
|
||||
import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service";
|
||||
import { ContainerService } from "@bitwarden/common/platform/services/container.service";
|
||||
import mock from "@bitwarden/common/platform/spec/mock-deep";
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { KeyService } from "@bitwarden/key-management";
|
||||
|
||||
import { makeSymmetricCryptoKey, mockContainerService, mockEnc } from "../../../../../spec";
|
||||
import { SendTextData } from "../data/send-text.data";
|
||||
|
||||
import { SendText } from "./send-text";
|
||||
|
||||
|
||||
describe("SendText", () => {
|
||||
let data: SendTextData;
|
||||
|
||||
@@ -44,8 +37,7 @@ describe("SendText", () => {
|
||||
it("Decrypt", async () => {
|
||||
const containerService = mockContainerService();
|
||||
containerService.getKeyService().userKey$.mockReturnValue(of(makeSymmetricCryptoKey(64)));
|
||||
containerService.getEncryptService()
|
||||
.decryptString.mockResolvedValue("text");
|
||||
containerService.getEncryptService().decryptString.mockResolvedValue("text");
|
||||
|
||||
const secureNote = new SendText();
|
||||
secureNote.text = mockEnc("text");
|
||||
|
||||
Reference in New Issue
Block a user