ydioy/tests/views/AboutView.spec.ts

29 lines
957 B
TypeScript

import { describe, it, expect } from "vitest";
import { mount } from "@vue/test-utils";
import AboutView from "../../src/views/AboutView.vue";
describe("AboutView", () => {
const wrapper = mount(AboutView);
it("renders h1", () => {
expect(wrapper.find("h1").text()).toContain("About YDIOY");
});
it("has the correct number of paragraphs", () => {
const paragraphs = wrapper.findAll("p");
expect(paragraphs).toHaveLength(4);
});
it("has link to dexie.js", () => {
const dexieLink = wrapper.find("a");
const dexieLinkAttributes = dexieLink.attributes();
expect(dexieLink).toBeDefined();
expect(Object.keys(dexieLinkAttributes)).toHaveLength(4);
expect(dexieLinkAttributes["href"]).toBe("https://dexie.org/");
expect(dexieLinkAttributes["target"]).toBe("_blank");
expect(dexieLinkAttributes["rel"]).toBe("noopener")
expect(dexieLinkAttributes["class"]).toContain("text-decoration-none");
});
});