1
0
mirror of https://github.com/bitwarden/jslib synced 2026-01-08 19:43:15 +00:00

Fix tests

This commit is contained in:
Hinton
2022-04-19 13:24:04 +02:00
parent 075a8af6bd
commit 7d4c665b54
2 changed files with 13 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
import { Substitute, SubstituteOf } from "@fluffy-spoon/substitute";
import { CryptoService } from "jslib-common/abstractions/crypto.service";
import { FolderService } from "jslib-common/abstractions/folder.service";
import { I18nService } from "jslib-common/abstractions/i18n.service";
import { BitwardenJsonImporter } from "jslib-common/importers/bitwardenJsonImporter";
@@ -10,12 +11,14 @@ describe("bitwarden json importer", () => {
let sut: BitwardenJsonImporter;
let cryptoService: SubstituteOf<CryptoService>;
let i18nService: SubstituteOf<I18nService>;
let folderService: SubstituteOf<FolderService>;
beforeEach(() => {
cryptoService = Substitute.for<CryptoService>();
i18nService = Substitute.for<I18nService>();
folderService = Substitute.for<FolderService>();
sut = new BitwardenJsonImporter(cryptoService, i18nService);
sut = new BitwardenJsonImporter(cryptoService, i18nService, folderService);
});
it("should fail if password is needed", async () => {

View File

@@ -1,6 +1,7 @@
import Substitute, { Arg, SubstituteOf } from "@fluffy-spoon/substitute";
import { CryptoService } from "jslib-common/abstractions/crypto.service";
import { FolderService } from "jslib-common/abstractions/folder.service";
import { I18nService } from "jslib-common/abstractions/i18n.service";
import { KdfType } from "jslib-common/enums/kdfType";
import { BitwardenPasswordProtectedImporter } from "jslib-common/importers/bitwardenPasswordProtectedImporter";
@@ -13,6 +14,7 @@ describe("BitwardenPasswordProtectedImporter", () => {
let importer: BitwardenPasswordProtectedImporter;
let cryptoService: SubstituteOf<CryptoService>;
let i18nService: SubstituteOf<I18nService>;
let folderService: SubstituteOf<FolderService>;
const password = Utils.newGuid();
const result = new ImportResult();
let jDoc: {
@@ -28,6 +30,7 @@ describe("BitwardenPasswordProtectedImporter", () => {
beforeEach(() => {
cryptoService = Substitute.for<CryptoService>();
i18nService = Substitute.for<I18nService>();
folderService = Substitute.for<FolderService>();
jDoc = {
encrypted: true,
@@ -40,7 +43,12 @@ describe("BitwardenPasswordProtectedImporter", () => {
};
result.success = true;
importer = new BitwardenPasswordProtectedImporter(cryptoService, i18nService, password);
importer = new BitwardenPasswordProtectedImporter(
cryptoService,
i18nService,
folderService,
password
);
});
describe("Required Json Data", () => {