test(AboutPage, ConfirmDialog, MapPage): update tests for improved component behavior and UI consistency
This commit is contained in:
@@ -91,24 +91,28 @@ describe("AboutPage.vue", () => {
|
||||
});
|
||||
|
||||
const wrapper = mountAboutPage();
|
||||
wrapper.vm.showAdvanced = true;
|
||||
await vi.runOnlyPendingTimers();
|
||||
await wrapper.vm.$nextTick();
|
||||
await wrapper.vm.$nextTick(); // Extra tick for multiple async calls
|
||||
await wrapper.vm.$nextTick();
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
expect(axiosMock.get).toHaveBeenCalledWith("/api/v1/app/info");
|
||||
expect(axiosMock.get).toHaveBeenCalledWith("/api/v1/config");
|
||||
|
||||
expect(wrapper.text()).toContain("Reticulum MeshChatX");
|
||||
expect(wrapper.text()).toContain("MeshChatX");
|
||||
expect(wrapper.text()).toContain("Reticulum Network Stack");
|
||||
expect(wrapper.text()).toContain("hash1");
|
||||
expect(wrapper.text()).toContain("hash2");
|
||||
|
||||
// Check for Dependency Chain section
|
||||
expect(wrapper.text()).toContain("about.dependency_chain");
|
||||
expect(wrapper.text()).toContain("Dependency Chain");
|
||||
expect(wrapper.text()).toContain("Lightweight Extensible Message Format");
|
||||
expect(wrapper.text()).toContain("Reticulum Network Stack");
|
||||
|
||||
// Check for dependencies
|
||||
expect(wrapper.text()).toContain("about.backend_dependencies");
|
||||
expect(wrapper.text()).toContain("Backend Stack");
|
||||
expect(wrapper.text()).toContain("aiohttp");
|
||||
expect(wrapper.text()).toContain("3.8.1");
|
||||
});
|
||||
@@ -133,6 +137,7 @@ describe("AboutPage.vue", () => {
|
||||
});
|
||||
|
||||
const wrapper = mountAboutPage();
|
||||
wrapper.vm.showAdvanced = true;
|
||||
await wrapper.vm.$nextTick();
|
||||
await wrapper.vm.$nextTick();
|
||||
await wrapper.vm.$nextTick();
|
||||
@@ -140,7 +145,7 @@ describe("AboutPage.vue", () => {
|
||||
|
||||
expect(getMemoryUsageSpy).toHaveBeenCalled();
|
||||
expect(wrapper.vm.electronMemoryUsage).not.toBeNull();
|
||||
expect(wrapper.text()).toContain("Electron Resources");
|
||||
expect(wrapper.text()).toContain("Environment Information");
|
||||
});
|
||||
|
||||
it("handles shutdown action", async () => {
|
||||
|
||||
@@ -95,12 +95,9 @@ describe("ConfirmDialog.vue", () => {
|
||||
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
const backdrop = wrapper.findAll(".fixed").find((el) => {
|
||||
const classes = el.classes();
|
||||
return classes.includes("inset-0") && !classes.includes("z-[200]");
|
||||
});
|
||||
const backdrop = wrapper.find(".backdrop-blur-sm");
|
||||
|
||||
if (backdrop && backdrop.exists()) {
|
||||
if (backdrop.exists()) {
|
||||
await backdrop.trigger("click");
|
||||
await wrapper.vm.$nextTick();
|
||||
expect(resolvePromise).toHaveBeenCalledWith(false);
|
||||
|
||||
@@ -19,6 +19,12 @@ vi.mock("ol/Map", () => ({
|
||||
on: vi.fn(),
|
||||
addLayer: vi.fn(),
|
||||
addInteraction: vi.fn(),
|
||||
addOverlay: vi.fn(),
|
||||
removeInteraction: vi.fn(),
|
||||
removeOverlay: vi.fn(),
|
||||
un: vi.fn(),
|
||||
getEventPixel: vi.fn().mockReturnValue([0, 0]),
|
||||
getTargetElement: vi.fn().mockReturnValue({ style: {} }),
|
||||
getView: vi.fn().mockReturnValue({
|
||||
on: vi.fn(),
|
||||
setCenter: vi.fn(),
|
||||
@@ -33,6 +39,9 @@ vi.mock("ol/Map", () => ({
|
||||
push: vi.fn(),
|
||||
getArray: vi.fn().mockReturnValue([]),
|
||||
}),
|
||||
getOverlays: vi.fn().mockReturnValue({
|
||||
getArray: vi.fn().mockReturnValue([]),
|
||||
}),
|
||||
forEachFeatureAtPixel: vi.fn(),
|
||||
setTarget: vi.fn(),
|
||||
updateSize: vi.fn(),
|
||||
@@ -129,10 +138,12 @@ describe("MapPage.vue", () => {
|
||||
patch: vi.fn().mockResolvedValue({ data: {} }),
|
||||
delete: vi.fn().mockResolvedValue({ data: {} }),
|
||||
};
|
||||
vi.stubGlobal("axios", axiosMock);
|
||||
window.axios = axiosMock;
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
vi.stubGlobal("axios", axiosMock);
|
||||
window.axios = axiosMock;
|
||||
// Mock localStorage
|
||||
const localStorageMock = {
|
||||
|
||||
Reference in New Issue
Block a user