mirror of
https://github.com/bitwarden/directory-connector
synced 2025-12-05 23:53:21 +00:00
* Unpackage-ify jslib * Adjust .tsconfig path for root and apply to jslib * Rebuild package-lock.json * Disable husky in CI * Revert an incorrect find/replace * Add jslib/shared/.eslintrc rules to root eslintrc * Revert package.json change to ignore spec files when linting * Ensure custom matcher gets imported in jslib tests * Fix small workflow bugs from merging * Try and get CI builds moving again * Always sign and notorize builds in CI * Revert erroneous verion bump
58 lines
1.3 KiB
TypeScript
58 lines
1.3 KiB
TypeScript
import { UriMatchType } from "@/jslib/common/src/enums/uriMatchType";
|
|
import { LoginUriData } from "@/jslib/common/src/models/data/loginUriData";
|
|
import { LoginUri } from "@/jslib/common/src/models/domain/loginUri";
|
|
|
|
import { mockEnc } from "../utils";
|
|
|
|
describe("LoginUri", () => {
|
|
let data: LoginUriData;
|
|
|
|
beforeEach(() => {
|
|
data = {
|
|
uri: "encUri",
|
|
match: UriMatchType.Domain,
|
|
};
|
|
});
|
|
|
|
it("Convert from empty", () => {
|
|
const data = new LoginUriData();
|
|
const loginUri = new LoginUri(data);
|
|
|
|
expect(loginUri).toEqual({
|
|
match: null,
|
|
uri: null,
|
|
});
|
|
});
|
|
|
|
it("Convert", () => {
|
|
const loginUri = new LoginUri(data);
|
|
|
|
expect(loginUri).toEqual({
|
|
match: 0,
|
|
uri: { encryptedString: "encUri", encryptionType: 0 },
|
|
});
|
|
});
|
|
|
|
it("toLoginUriData", () => {
|
|
const loginUri = new LoginUri(data);
|
|
expect(loginUri.toLoginUriData()).toEqual(data);
|
|
});
|
|
|
|
it("Decrypt", async () => {
|
|
const loginUri = new LoginUri();
|
|
loginUri.match = UriMatchType.Exact;
|
|
loginUri.uri = mockEnc("uri");
|
|
|
|
const view = await loginUri.decrypt(null);
|
|
|
|
expect(view).toEqual({
|
|
_canLaunch: null,
|
|
_domain: null,
|
|
_host: null,
|
|
_hostname: null,
|
|
_uri: "uri",
|
|
match: 3,
|
|
});
|
|
});
|
|
});
|