import {
cleanup,
render,
screen,
} from "@testing-library/react";
import assert from "node:assert";
import {
afterEach,
describe,
test,
} from "node:test";
import { Logo } from "./index";
describe("Logo", () => {
afterEach(() => {
cleanup();
});
test("renders link and image with defaults", () => {
render();
const link = screen.getByRole("link");
const img = screen.getByRole("img");
assert.strictEqual(link.getAttribute("href"), "https://d-element.ru/");
assert.strictEqual((img as HTMLImageElement).src.includes("/logo.svg"), true);
});
test("passes custom attrs to link and image", () => {
render(
);
const link = screen.getByRole("link");
const img = screen.getByRole("img");
assert.strictEqual(link.getAttribute("href"), "https://example.com");
assert.strictEqual(link.getAttribute("target"), "_self");
assert.strictEqual(img.getAttribute("alt"), "Example logo");
});
test("uses explicit aria-label and title on link", () => {
render(
);
const link = screen.getByRole("link");
assert.strictEqual(link.getAttribute("aria-label"), "Company logo");
assert.strictEqual(link.getAttribute("title"), "Open company site");
});
});