From cc0b238de962449e80f04b87a7cfb76fae7cdee0 Mon Sep 17 00:00:00 2001 From: Jeppe Bundgaard Date: Thu, 23 Apr 2026 15:47:02 +0200 Subject: [PATCH] Align unit contracts with latest master routes and POS UI --- tests/unit/edge-gateway-workspace.spec.js | 12 ++++++------ tests/unit/select-vehicle-form-pos.spec.js | 12 ++++++------ tests/unit/system-search-route-contract.spec.js | 4 +++- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/tests/unit/edge-gateway-workspace.spec.js b/tests/unit/edge-gateway-workspace.spec.js index baef8f84..a86bc1b2 100644 --- a/tests/unit/edge-gateway-workspace.spec.js +++ b/tests/unit/edge-gateway-workspace.spec.js @@ -74,12 +74,12 @@ describe("edge gateway workspace contract", () => { expect(manageSource).toContain('data-testid="gateway-settings-page"'); expect(manageSource).toContain('data-testid="gateway-rotate-confirmation"'); expect(manageSource).toContain('data-testid="gateway-delete-confirmation"'); - expect(managerSource).toContain("const mergeStatisticsSnapshot = (statistics, gateway) =>"); - expect(managerSource).toContain("const localGateway = findLocalGatewaySnapshot(gatewayId);"); - expect(managerSource).toContain("if (payload?.gateway && !localGateway)"); - expect(managerSource).toContain("statisticsSnapshot.value = mergeStatisticsSnapshot("); - expect(managerSource).toContain("payload || {},"); - expect(managerSource).toContain("localGateway || payload?.gateway || null"); + expect(managerSource).toContain("const refreshStatisticsSnapshot = async (gatewayId = activeGatewayId.value) =>"); + expect(managerSource).toContain( + 'statisticsSnapshot.value = payload && typeof payload === "object" ? payload : {};' + ); + expect(managerSource).toContain("if (statisticsSnapshot.value?.gateway) {"); + expect(managerSource).toContain("setSelectedGatewaySnapshot(statisticsSnapshot.value.gateway);"); }); it("mounts a module workspace and a safe-subset department workspace", () => { diff --git a/tests/unit/select-vehicle-form-pos.spec.js b/tests/unit/select-vehicle-form-pos.spec.js index 8be065ac..e3f01087 100644 --- a/tests/unit/select-vehicle-form-pos.spec.js +++ b/tests/unit/select-vehicle-form-pos.spec.js @@ -312,9 +312,9 @@ describe("SelectVehicleFormPOS", () => { await wrapper.get('[data-testid="expandable-toggle"]').trigger("click"); await nextTick(); - expect(wrapper.findAll('[data-testid="customer-search-field-pos-stub"]')).toHaveLength(2); - expect(wrapper.findAll('[data-testid="customer-search-new-customer-stub"]')).toHaveLength(2); - expect(wrapper.findAll('[data-testid="customer-search-card-payment-stub"]')).toHaveLength(2); + expect(wrapper.findAll('[data-testid="customer-search-field-pos-stub"]')).toHaveLength(1); + expect(wrapper.findAll('[data-testid="customer-search-new-customer-stub"]')).toHaveLength(1); + expect(wrapper.findAll('[data-testid="customer-search-card-payment-stub"]')).toHaveLength(1); }); it("moves customer selection into the expanded other section for linked vehicles", async () => { @@ -328,8 +328,8 @@ describe("SelectVehicleFormPOS", () => { await wrapper.get('[data-testid="expandable-toggle"]').trigger("click"); await nextTick(); - expect(wrapper.findAll('[data-testid="customer-search-field-pos-stub"]')).toHaveLength(1); - expect(wrapper.findAll('[data-testid="customer-search-new-customer-stub"]')).toHaveLength(1); - expect(wrapper.findAll('[data-testid="customer-search-card-payment-stub"]')).toHaveLength(1); + expect(wrapper.findAll('[data-testid="customer-search-field-pos-stub"]')).toHaveLength(2); + expect(wrapper.findAll('[data-testid="customer-search-new-customer-stub"]')).toHaveLength(2); + expect(wrapper.findAll('[data-testid="customer-search-card-payment-stub"]')).toHaveLength(2); }); }); diff --git a/tests/unit/system-search-route-contract.spec.js b/tests/unit/system-search-route-contract.spec.js index fed0d425..05473b10 100644 --- a/tests/unit/system-search-route-contract.spec.js +++ b/tests/unit/system-search-route-contract.spec.js @@ -8,7 +8,9 @@ const recordPageSource = readFileSync(join(root, "src/views/search/SystemSearchR describe("system search generic record route contract", () => { it("registers authenticated generic record route in router", () => { - expect(routerSource).toContain('import SystemSearchRecordPage from "@/views/search/SystemSearchRecordPage.vue";'); + expect(routerSource).toContain( + "const SystemSearchRecordPage = lazyView('@/views/search/SystemSearchRecordPage.vue');" + ); expect(routerSource).toContain("name: 'systemsearchrecord'"); expect(routerSource).toContain("path: '/search/system/record/:entityType/:entityId'"); expect(routerSource).toContain("component: SystemSearchRecordPage");