Added runtimeConfig and used it for appVersion in the footer
This commit is contained in:
parent
3897072e27
commit
52b255df65
4 changed files with 30 additions and 4 deletions
|
|
@ -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)");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue