38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
import { mount } from "@vue/test-utils";
|
|
import DefaultLayout from "~/layouts/Default.vue";
|
|
|
|
describe("Default.vue", () => {
|
|
afterEach(() => {
|
|
vi.useRealTimers();
|
|
});
|
|
|
|
it("loads without crashing", () => {
|
|
const wrapper = mount(DefaultLayout);
|
|
expect(wrapper.exists()).toBe(true);
|
|
});
|
|
|
|
describe("Footer", () => {
|
|
it("footer is displayed", () => {
|
|
const wrapper = mount(DefaultLayout);
|
|
const footer = wrapper.find("[data-testid='footer']");
|
|
expect(footer.exists()).toBe(true);
|
|
});
|
|
|
|
it("footer shows only 2025 when current year is 2025", () => {
|
|
vi.useFakeTimers();
|
|
vi.setSystemTime(new Date(2025, 0, 1));
|
|
const wrapper = mount(DefaultLayout);
|
|
const footer = wrapper.find("[data-testid='footer']");
|
|
expect(footer.text()).toBe("Glowing Fiesta 2025");
|
|
});
|
|
|
|
it("footer shows range when current year is not 2025", () => {
|
|
vi.useFakeTimers();
|
|
vi.setSystemTime(new Date(2069, 0, 1));
|
|
const wrapper = mount(DefaultLayout);
|
|
const footer = wrapper.find("[data-testid='footer']");
|
|
expect(footer.text()).toBe("Glowing Fiesta 2025 - 2069");
|
|
});
|
|
});
|
|
});
|