mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 22:03:36 +00:00
[PM-18659] Remove console logs from importers unit tests (#13583)
* Remove console logs from importers unit tests * Add fixme
This commit is contained in:
@@ -20,6 +20,7 @@ import { ImportResult } from "../models/import-result";
|
|||||||
export abstract class BaseImporter {
|
export abstract class BaseImporter {
|
||||||
organizationId: string = null;
|
organizationId: string = null;
|
||||||
|
|
||||||
|
// FIXME: This should be replaced by injecting the log service.
|
||||||
protected logService: LogService = new ConsoleLogService(false);
|
protected logService: LogService = new ConsoleLogService(false);
|
||||||
|
|
||||||
protected newLineRegex = /(?:\r\n|\r|\n)/;
|
protected newLineRegex = /(?:\r\n|\r|\n)/;
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ describe("PasswordXPCsvImporter", () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
importer = new PasswordXPCsvImporter();
|
importer = new PasswordXPCsvImporter();
|
||||||
|
// Importers currently create their own ConsoleLogService. This should be replaced by injecting a test log service.
|
||||||
|
jest.spyOn(console, "warn").mockImplementation();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should return success false if CSV data is null", async () => {
|
it("should return success false if CSV data is null", async () => {
|
||||||
|
|||||||
@@ -5,6 +5,11 @@ import { data as dataNoFolder } from "./spec-data/roboform-csv/empty-folders";
|
|||||||
import { data as dataFolder } from "./spec-data/roboform-csv/with-folders";
|
import { data as dataFolder } from "./spec-data/roboform-csv/with-folders";
|
||||||
|
|
||||||
describe("Roboform CSV Importer", () => {
|
describe("Roboform CSV Importer", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
// Importers currently create their own ConsoleLogService. This should be replaced by injecting a test log service.
|
||||||
|
jest.spyOn(console, "warn").mockImplementation();
|
||||||
|
});
|
||||||
|
|
||||||
it("should parse CSV data", async () => {
|
it("should parse CSV data", async () => {
|
||||||
const importer = new RoboFormCsvImporter();
|
const importer = new RoboFormCsvImporter();
|
||||||
const result = await importer.parse(dataNoFolder);
|
const result = await importer.parse(dataNoFolder);
|
||||||
|
|||||||
@@ -51,6 +51,11 @@ const CipherData = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
describe("SecureSafe CSV Importer", () => {
|
describe("SecureSafe CSV Importer", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
// Importers currently create their own ConsoleLogService. This should be replaced by injecting a test log service.
|
||||||
|
jest.spyOn(console, "warn").mockImplementation();
|
||||||
|
});
|
||||||
|
|
||||||
CipherData.forEach((data) => {
|
CipherData.forEach((data) => {
|
||||||
it(data.title, async () => {
|
it(data.title, async () => {
|
||||||
const importer = new SecureSafeCsvImporter();
|
const importer = new SecureSafeCsvImporter();
|
||||||
|
|||||||
Reference in New Issue
Block a user