2022-06-14 17:10:53 +02:00
|
|
|
import { FSecureFskImporter as Importer } from "@bitwarden/common/importers/fsecureFskImporter";
|
2021-12-14 10:22:09 +01:00
|
|
|
|
|
|
|
const TestDataWithStyleSetToWebsite: string = JSON.stringify({
|
|
|
|
data: {
|
|
|
|
"8d58b5cf252dd06fbd98f5289e918ab1": {
|
|
|
|
color: "#00baff",
|
|
|
|
reatedDate: 1609302913,
|
|
|
|
creditCvv: "",
|
|
|
|
creditExpiry: "",
|
|
|
|
creditNumber: "",
|
|
|
|
favorite: 0,
|
|
|
|
modifiedDate: 1609302913,
|
|
|
|
notes: "note",
|
|
|
|
password: "word",
|
|
|
|
passwordList: [],
|
|
|
|
passwordModifiedDate: 1609302913,
|
|
|
|
rev: 1,
|
|
|
|
service: "My first pass",
|
|
|
|
style: "website",
|
|
|
|
type: 1,
|
|
|
|
url: "https://bitwarden.com",
|
|
|
|
username: "pass",
|
2021-12-16 13:36:21 +01:00
|
|
|
},
|
2021-12-14 10:22:09 +01:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const TestDataWithStyleSetToGlobe: string = JSON.stringify({
|
2021-12-16 13:36:21 +01:00
|
|
|
data: {
|
2021-12-14 10:22:09 +01:00
|
|
|
"8d58b5cf252dd06fbd98f5289e918ab1": {
|
|
|
|
color: "#00baff",
|
|
|
|
reatedDate: 1609302913,
|
|
|
|
creditCvv: "",
|
|
|
|
creditExpiry: "",
|
|
|
|
creditNumber: "",
|
|
|
|
favorite: 0,
|
|
|
|
modifiedDate: 1609302913,
|
|
|
|
notes: "note",
|
|
|
|
password: "word",
|
|
|
|
passwordList: [],
|
|
|
|
passwordModifiedDate: 1609302913,
|
2021-12-16 13:36:21 +01:00
|
|
|
rev: 1,
|
2021-12-14 10:22:09 +01:00
|
|
|
service: "My first pass",
|
|
|
|
style: "globe",
|
2021-12-16 13:36:21 +01:00
|
|
|
type: 1,
|
2021-12-14 10:22:09 +01:00
|
|
|
url: "https://bitwarden.com",
|
|
|
|
username: "pass",
|
2021-12-16 13:36:21 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
2021-12-14 10:22:09 +01:00
|
|
|
|
|
|
|
describe("FSecure FSK Importer", () => {
|
|
|
|
it("should parse data with style set to website", async () => {
|
|
|
|
const importer = new Importer();
|
|
|
|
const result = await importer.parse(TestDataWithStyleSetToWebsite);
|
|
|
|
expect(result != null).toBe(true);
|
|
|
|
|
|
|
|
const cipher = result.ciphers.shift();
|
|
|
|
expect(cipher.login.username).toEqual("pass");
|
|
|
|
expect(cipher.login.password).toEqual("word");
|
|
|
|
expect(cipher.login.uris.length).toEqual(1);
|
|
|
|
const uriView = cipher.login.uris.shift();
|
|
|
|
expect(uriView.uri).toEqual("https://bitwarden.com");
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should parse data with style set to globe", async () => {
|
|
|
|
const importer = new Importer();
|
|
|
|
const result = await importer.parse(TestDataWithStyleSetToGlobe);
|
|
|
|
expect(result != null).toBe(true);
|
|
|
|
|
|
|
|
const cipher = result.ciphers.shift();
|
|
|
|
expect(cipher.login.username).toEqual("pass");
|
|
|
|
expect(cipher.login.password).toEqual("word");
|
|
|
|
expect(cipher.login.uris.length).toEqual(1);
|
|
|
|
const uriView = cipher.login.uris.shift();
|
|
|
|
expect(uriView.uri).toEqual("https://bitwarden.com");
|
|
|
|
});
|
|
|
|
});
|