Added runtimeConfig and used it for appVersion in the footer

This commit is contained in:
Liviu Burcusel 2025-12-24 11:14:03 +01:00
parent 3897072e27
commit 52b255df65
Signed by: liviu
GPG key ID: 6CDB37A4AD2C610C
4 changed files with 30 additions and 4 deletions

View file

@ -2,6 +2,14 @@ import { afterEach, describe, expect, it, vi } from "vitest";
import { mount } from "@vue/test-utils";
import DefaultLayout from "~/layouts/Default.vue";
vi.mock("#app", () => ({
useRuntimeConfig: () => ({
public: {
appVersion: "1.0.1",
},
}),
}));
describe("Default.vue", () => {
afterEach(() => {
vi.useRealTimers();
@ -24,7 +32,7 @@ describe("Default.vue", () => {
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");
expect(footer.text()).toBe("Glowing Fiesta 2025 (1.0.1)");
});
it("footer shows range when current year is not 2025", () => {
@ -32,7 +40,7 @@ describe("Default.vue", () => {
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");
expect(footer.text()).toBe("Glowing Fiesta 2025 - 2069 (1.0.1)");
});
});
});