Merge branch 'main' into auth/pm-45038-retain-open-invite-and-link-after-sso-jit-setup

This commit is contained in:
rr-bw
2026-11-13 14:13:28 -06:00
committed by GitHub
4 changed files with 55 additions and 31 deletions

View File

@@ -8,7 +8,7 @@ import { credentialsData_otpUrl } from "../spec-data/dashlane-csv/credentials-ot
import { credentialsData } from "../spec-data/dashlane-csv/credentials.csv";
import { identityData } from "../spec-data/dashlane-csv/id.csv";
import { multiplePersonalInfoData } from "../spec-data/dashlane-csv/multiple-personal-info.csv";
import { paymentsData } from "../spec-data/dashlane-csv/payments.csv";
import { currentCCData, legacyCCData, paymentsData } from "../spec-data/dashlane-csv/payments.csv";
import { personalInfoData } from "../spec-data/dashlane-csv/personal-info.csv";
import { secureNoteData } from "../spec-data/dashlane-csv/securenotes.csv";
import { assertCustomFieldsStructure } from "../spec-data/importer-test-utils";
@@ -67,7 +67,7 @@ describe("Dashlane CSV Importer", () => {
it("with new item types feature flag OFF", async () => {
const result = await getImportResult(paymentsData);
expect(result.ciphers.length).toEqual(2);
expect(result.ciphers.length).toEqual(1);
// Account
const cipher = result.ciphers[0];
@@ -86,29 +86,13 @@ describe("Dashlane CSV Importer", () => {
["country", "US"],
["issuing_bank", "US-ALLY"],
]);
// CreditCard
const cipher2 = result.ciphers[1];
expect(cipher2.type).toEqual(CipherType.Card);
expect(cipher2.name).toEqual("John Doe");
expect(cipher2.card.brand).toEqual("Visa");
expect(cipher2.card.cardholderName).toEqual("John Doe");
expect(cipher2.card.number).toEqual("41111111111111111");
expect(cipher2.card.code).toEqual("123");
expect(cipher2.card.expMonth).toEqual("1");
expect(cipher2.card.expYear).toEqual("2023");
assertCustomFieldsStructure(cipher2.fields, [
["type", "credit_card"],
["country", "US"],
]);
});
it("with new item types feature flag ON", async () => {
configService.getFeatureFlag.mockResolvedValueOnce(true);
const result = await getImportResult(paymentsData);
expect(result.ciphers.length).toEqual(2);
expect(result.ciphers.length).toEqual(1);
// Account
const cipher = result.ciphers[0];
@@ -122,23 +106,49 @@ describe("Dashlane CSV Importer", () => {
["country", "US"],
["issuing_bank", "US-ALLY"],
]);
});
// CreditCard
const cipher2 = result.ciphers[1];
expect(cipher2.type).toEqual(CipherType.Card);
expect(cipher2.name).toEqual("John Doe");
expect(cipher2.card.brand).toEqual("Visa");
expect(cipher2.card.cardholderName).toEqual("John Doe");
expect(cipher2.card.number).toEqual("41111111111111111");
expect(cipher2.card.code).toEqual("123");
expect(cipher2.card.expMonth).toEqual("1");
expect(cipher2.card.expYear).toEqual("2023");
it("parses the legacy credit_card export format for credit cards", async () => {
const result = await getImportResult(legacyCCData);
assertCustomFieldsStructure(cipher2.fields, [
expect(result.ciphers.length).toEqual(1);
const cipher = result.ciphers[0];
expect(cipher.type).toEqual(CipherType.Card);
expect(cipher.name).toEqual("John Doe");
expect(cipher.card.brand).toEqual("Visa");
expect(cipher.card.cardholderName).toEqual("John Doe");
expect(cipher.card.number).toEqual("41111111111111111");
expect(cipher.card.code).toEqual("123");
expect(cipher.card.expMonth).toEqual("1");
expect(cipher.card.expYear).toEqual("2023");
assertCustomFieldsStructure(cipher.fields, [
["type", "credit_card"],
["country", "US"],
]);
});
it("parses the current payment_card export format for credit cards", async () => {
const result = await getImportResult(currentCCData);
expect(result.ciphers.length).toEqual(1);
const cipher = result.ciphers[0];
expect(cipher.type).toEqual(CipherType.Card);
expect(cipher.name).toEqual("Test Credit Card");
expect(cipher.card.brand).toEqual("Visa");
expect(cipher.card.cardholderName).toEqual("John Doe");
expect(cipher.card.number).toEqual("41111111111111111");
expect(cipher.card.code).toEqual("123");
expect(cipher.card.expMonth).toEqual("1");
expect(cipher.card.expYear).toEqual("2023");
assertCustomFieldsStructure(cipher.fields, [
["type", "payment_card"],
["country", "US"],
]);
});
});
describe("should parse ids records", () => {

View File

@@ -147,6 +147,13 @@ export class DashlaneCsvImporter extends BaseImporter implements Importer {
let mappedValues: string[] = [];
switch (row.type) {
case "credit_card":
case "payment_card":
// Dashlane's curent CSV export uses `payment_card` instead of `credit_card`, but we support both
// If a credit card item has no specific item name (exported to the `name` column in the current
// export format) the cardholder name in `account_name` is used as the item title instead
cipher.type = CipherType.Card;
cipher.card = new CardView();
cipher.name = !this.isNullOrWhitespace(row.name) ? row.name : row.account_name;
cipher.card.cardholderName = row.account_name;
cipher.card.number = row.cc_number;
cipher.card.brand = CardView.getCardBrandByPatterns(cipher.card.number);
@@ -161,6 +168,7 @@ export class DashlaneCsvImporter extends BaseImporter implements Importer {
"code",
"expiration_month",
"expiration_year",
"name",
];
break;
case "bank":

View File

@@ -26,6 +26,7 @@ export class PaymentsRecord {
account_number: string;
country: string;
issuing_bank: string;
name?: string;
}
export class IdRecord {

View File

@@ -1,3 +1,8 @@
export const paymentsData = `type,account_name,account_holder,cc_number,code,expiration_month,expiration_year,routing_number,account_number,country,issuing_bank
bank,John's savings account,John Doe,,,,,routingNumber,accountNumber,US,US-ALLY
bank,John's savings account,John Doe,,,,,routingNumber,accountNumber,US,US-ALLY`;
export const legacyCCData = `type,account_name,account_holder,cc_number,code,expiration_month,expiration_year,routing_number,account_number,country,issuing_bank
credit_card,John Doe,,41111111111111111,123,01,2023,,,US,`;
export const currentCCData = `type,account_name,account_holder,cc_number,code,expiration_month,expiration_year,routing_number,account_number,country,issuing_bank,note,name
payment_card,John Doe,,41111111111111111,123,01,2023,,,US,,,Test Credit Card`;