generated from nhcarrigan/template
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
/**
|
|
* @copyright NHCarrigan
|
|
* @license Naomi's Public License
|
|
* @author Naomi Carrigan
|
|
*/
|
|
|
|
import type { Link } from "../src/lib/common.types";
|
|
|
|
describe("common Types", () => {
|
|
describe("link interface", () => {
|
|
it("should accept valid Link objects", () => {
|
|
const validLink: Link = {
|
|
title: "Example Website",
|
|
url: "https://example.com",
|
|
};
|
|
|
|
expect(validLink.title).toBe("Example Website");
|
|
expect(validLink.url).toBe("https://example.com");
|
|
});
|
|
|
|
it("should work with different URL formats", () => {
|
|
const links: Array<Link> = [
|
|
{ title: "HTTP URL", url: "http://example.com" },
|
|
{ title: "HTTPS URL", url: "https://example.com" },
|
|
{ title: "Relative URL", url: "/path/to/page" },
|
|
{ title: "URL with query", url: "https://example.com?query=value" },
|
|
{ title: "URL with anchor", url: "https://example.com#section" },
|
|
];
|
|
|
|
expect(links).toHaveLength(5);
|
|
for (const link of links) {
|
|
expect(link).toHaveProperty("title");
|
|
expect(link).toHaveProperty("url");
|
|
}
|
|
});
|
|
});
|
|
});
|