From 8d0a425f0c12b1466d86e0907937dc0c925846ce Mon Sep 17 00:00:00 2001 From: Kevin Janssen Date: Tue, 17 Nov 2026 22:10:33 +0100 Subject: [PATCH] Name customer selectors and validate customer fixtures during frontend builds --- tests/browser/customer-management.spec.ts | 10 +++++++--- web/src/devices.tsx | 2 ++ web/src/main.tsx | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/browser/customer-management.spec.ts b/tests/browser/customer-management.spec.ts index f037b7e..92b8802 100644 --- a/tests/browser/customer-management.spec.ts +++ b/tests/browser/customer-management.spec.ts @@ -52,8 +52,10 @@ test('creates and renames a customer, opens its inventory, and hides editing for return route.fulfill({ json: { ...listing(customers), can_manage_customers: canManage } }); } if (method === 'GET' && path === `${collection}/${customerId}/devices`) { + const customer = customers.find(c => c.tenant_id === customerId); + if (!customer) throw new Error('Kunde fehlt im Testbestand'); return route.fulfill({ json: listing([{ - tenant_id: customerId, customer_name: customers[1].name, asset_id: 'device-1', agent_id: 'agent-1', + tenant_id: customerId, customer_name: customer.name, asset_id: 'device-1', agent_id: 'agent-1', lifecycle: 'current', status: 'online', hostname: 'NORD-PC', os: 'Linux' }]) }); } @@ -69,8 +71,10 @@ test('creates and renames a customer, opens its inventory, and hides editing for } if (method === 'PATCH' && path === `${collection}/${customerId}`) { expect(request.headers()['x-rmm-tenant']).toBe(customerId); - customers[1].name = body.name; - return route.fulfill({ json: customers[1] }); + const customer = customers.find(c => c.tenant_id === customerId); + if (!customer) throw new Error('Unbekannter Testkunde'); + customer.name = body.name; + return route.fulfill({ json: customer }); } } return route.fulfill({ status: 404, json: { code: 'UNEXPECTED_FIXTURE_REQUEST', message: path } }); diff --git a/web/src/devices.tsx b/web/src/devices.tsx index bf1aaf2..4106801 100644 --- a/web/src/devices.tsx +++ b/web/src/devices.tsx @@ -407,6 +407,7 @@ export function Devices({