mirror of
https://github.com/bitwarden/browser
synced 2026-01-27 23:03:45 +00:00
Improves coverage.
This commit is contained in:
@@ -170,6 +170,44 @@ describe("NotificationBackground", () => {
|
||||
|
||||
expect(cipherView.folderId).toEqual(folderId);
|
||||
});
|
||||
|
||||
it("removes 'www.' prefix from hostname when generating cipher name", () => {
|
||||
const message: AddLoginQueueMessage = {
|
||||
type: "add",
|
||||
data: {
|
||||
username: "test",
|
||||
password: "password",
|
||||
uri: "https://www.example.com",
|
||||
},
|
||||
domain: "www.example.com",
|
||||
tab: createChromeTabMock(),
|
||||
expires: new Date(),
|
||||
wasVaultLocked: false,
|
||||
launchTimestamp: 0,
|
||||
};
|
||||
const cipherView = notificationBackground["convertAddLoginQueueMessageToCipherView"](message);
|
||||
|
||||
expect(cipherView.name).toEqual("example.com");
|
||||
});
|
||||
|
||||
it("uses domain as fallback when hostname cannot be extracted from uri", () => {
|
||||
const message: AddLoginQueueMessage = {
|
||||
type: "add",
|
||||
data: {
|
||||
username: "test",
|
||||
password: "password",
|
||||
uri: "",
|
||||
},
|
||||
domain: "fallback-domain.com",
|
||||
tab: createChromeTabMock(),
|
||||
expires: new Date(),
|
||||
wasVaultLocked: false,
|
||||
launchTimestamp: 0,
|
||||
};
|
||||
const cipherView = notificationBackground["convertAddLoginQueueMessageToCipherView"](message);
|
||||
|
||||
expect(cipherView.name).toEqual("fallback-domain.com");
|
||||
});
|
||||
});
|
||||
|
||||
describe("notification bar extension message handlers and triggers", () => {
|
||||
|
||||
Reference in New Issue
Block a user