Name customer selectors and validate customer fixtures during frontend builds

This commit is contained in:
2026-11-17 22:10:33 +01:00
parent fae4b4562b
commit 8d0a425f0c
3 changed files with 11 additions and 5 deletions
+7 -3
View File
@@ -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 } });