Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

1.0 KB
Raw Blame
import type { ContactEntities } from "../types";
import { describe, expect, it } from "vite-plus/test";
import { hasProfessionalLink } from "./contact";

const contact = (urls: string[], emails: string[] = ["[email protected]"]) =>
	({ emails, phones: [], textUrls: urls, annotationUrls: [] }) as unknown as ContactEntities;

describe("hasProfessionalLink", () => {
	it("counts known profiles and personal sites", () => {
		expect(hasProfessionalLink(contact(["https://linkedin.com/in/maya"]))).toBe(true);
		expect(hasProfessionalLink(contact(["https://example.com/portfolio"]))).toBe(true);
		expect(hasProfessionalLink(contact(["HTTPS://portfolio.example.com"]))).toBe(true);
		expect(hasProfessionalLink(contact(["morgan.design"]))).toBe(true);
	});

	it("doesn't count the email's own domain or mail links", () => {
		expect(hasProfessionalLink(contact(["mayabennett.example.com"]))).toBe(false);
		expect(hasProfessionalLink(contact(["mailto:[email protected]"]))).toBe(false);
		expect(hasProfessionalLink(contact([]))).toBe(false);
	});
});