feat(tests): add unit tests for BanishedPage and RNPathPage components, enhancing coverage for blocked items and path management

This commit is contained in:
2026-01-04 12:42:02 -06:00
parent bc40dcff4e
commit 54ccc03c4d
5 changed files with 280 additions and 8 deletions

View File

@@ -14,6 +14,7 @@ describe("LanguageSelector.vue", () => {
},
stubs: {
MaterialDesignIcon: true,
Teleport: true,
},
},
});
@@ -28,20 +29,20 @@ describe("LanguageSelector.vue", () => {
const wrapper = mountLanguageSelector();
const button = wrapper.find("button");
expect(wrapper.find(".absolute").exists()).toBe(false);
expect(wrapper.find(".fixed").exists()).toBe(false);
await button.trigger("click");
expect(wrapper.find(".absolute").exists()).toBe(true);
expect(wrapper.find(".fixed").exists()).toBe(true);
await button.trigger("click");
expect(wrapper.find(".absolute").exists()).toBe(false);
expect(wrapper.find(".fixed").exists()).toBe(false);
});
it("lists all available languages in the dropdown", async () => {
const wrapper = mountLanguageSelector();
await wrapper.find("button").trigger("click");
const languageButtons = wrapper.findAll(".absolute button");
const languageButtons = wrapper.findAll(".fixed button");
expect(languageButtons).toHaveLength(3);
expect(languageButtons[0].text()).toContain("English");
expect(languageButtons[1].text()).toContain("Deutsch");
@@ -52,22 +53,22 @@ describe("LanguageSelector.vue", () => {
const wrapper = mountLanguageSelector("en");
await wrapper.find("button").trigger("click");
const deButton = wrapper.findAll(".absolute button")[1];
const deButton = wrapper.findAll(".fixed button")[1];
await deButton.trigger("click");
expect(wrapper.emitted("language-change")).toBeTruthy();
expect(wrapper.emitted("language-change")[0]).toEqual(["de"]);
expect(wrapper.find(".absolute").exists()).toBe(false);
expect(wrapper.find(".fixed").exists()).toBe(false);
});
it("does not emit language-change when the current language is selected", async () => {
const wrapper = mountLanguageSelector("en");
await wrapper.find("button").trigger("click");
const enButton = wrapper.findAll(".absolute button")[0];
const enButton = wrapper.findAll(".fixed button")[0];
await enButton.trigger("click");
expect(wrapper.emitted("language-change")).toBeFalsy();
expect(wrapper.find(".absolute").exists()).toBe(false);
expect(wrapper.find(".fixed").exists()).toBe(false);
});
});