mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-02 13:23:29 +01:00
0e78910582
* Rename all importer related files Renamed all files based on our naming convention which we decided on with https://github.com/bitwarden/adr/blob/master/decisions/0012-angular-filename-convention.md * Removed entries from whitelist-capital-letters.txt * Rename missing safeInCloud test data * Fix broken import * Renamed folders (removed capital letters) * Fix filename of BitwardenCsvImporter * Fix imports of onepassword mac/win importer tests * Remove already renamed folders from whitelist * Rename dashlaneImporters to dashlane Rename the folder Fix all the imports Remove dashlaneImporters from white-list * Rename keeperImporters to keeper Rename the folder Fix all the imports Remove keeperImporters from white-list * Rename onepasswordImporters to onepassword Rename the folder Fix all the imports Remove onepasswordImporters from white-list * Rename safeinCloud test data folder * Fix onepassword importer type imports
33 lines
1.2 KiB
TypeScript
33 lines
1.2 KiB
TypeScript
// eslint-disable-next-line no-restricted-imports
|
|
import { Substitute, SubstituteOf } from "@fluffy-spoon/substitute";
|
|
|
|
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|
import { BitwardenJsonImporter } from "@bitwarden/common/importers/bitwarden-json-importer";
|
|
|
|
import { data as passwordProtectedData } from "./test-data/bitwarden-json/password-protected.json";
|
|
|
|
describe("bitwarden json importer", () => {
|
|
let sut: BitwardenJsonImporter;
|
|
let cryptoService: SubstituteOf<CryptoService>;
|
|
let i18nService: SubstituteOf<I18nService>;
|
|
|
|
beforeEach(() => {
|
|
cryptoService = Substitute.for<CryptoService>();
|
|
i18nService = Substitute.for<I18nService>();
|
|
|
|
sut = new BitwardenJsonImporter(cryptoService, i18nService);
|
|
});
|
|
|
|
it("should fail if password is needed", async () => {
|
|
expect((await sut.parse(passwordProtectedData)).success).toBe(false);
|
|
});
|
|
|
|
it("should return password needed error message", async () => {
|
|
const expected = "Password required error message";
|
|
i18nService.t("importPasswordRequired").returns(expected);
|
|
|
|
expect((await sut.parse(passwordProtectedData)).errorMessage).toEqual(expected);
|
|
});
|
|
});
|