mirror of
https://github.com/bitwarden/jslib
synced 2026-01-08 19:43:15 +00:00
Fix tests
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
@@ -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", () => {
|
||||
|
||||
Reference in New Issue
Block a user