Restore gateway smoke helpers after route spec cleanup
Keep the gateway health-card smoke test runnable after removing the stale replication-management helper block.
This commit is contained in:
@@ -38,6 +38,59 @@ async function installSystemStatusMock(page, snapshot) {
|
||||
});
|
||||
}
|
||||
|
||||
function createGateway(id, overrides = {}) {
|
||||
return {
|
||||
id,
|
||||
label: `Gateway ${id}`,
|
||||
hostname: `gateway-${id}.truckwash.test`,
|
||||
department_id: 11,
|
||||
status: "ONLINE",
|
||||
discovery_status: "READY",
|
||||
last_heartbeat_at: "2026-04-08T09:00:00.000Z",
|
||||
active_operation: null,
|
||||
diagnostics: [],
|
||||
error_state: null,
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
function createGatewayFleetUsage(rows) {
|
||||
return {
|
||||
gateways: {
|
||||
total: rows.length,
|
||||
online: rows.filter((gateway) => gateway.status === "ONLINE").length,
|
||||
degraded: rows.filter((gateway) => gateway.status === "DEGRADED").length,
|
||||
offline: rows.filter((gateway) => gateway.status === "OFFLINE").length,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
async function installGatewayFleetMock(page, { rows, departments }) {
|
||||
await page.route(/\/edge-gateways(?:\?.*)?$/, async (route) => {
|
||||
await route.fulfill(
|
||||
json({
|
||||
success: true,
|
||||
data: rows,
|
||||
meta: {
|
||||
fleet_usage: createGatewayFleetUsage(rows),
|
||||
},
|
||||
includes: {},
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
await page.route(/\/departments(?:\?.*)?$/, async (route) => {
|
||||
await route.fulfill(
|
||||
json({
|
||||
success: true,
|
||||
data: departments,
|
||||
meta: {},
|
||||
includes: {},
|
||||
})
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
const degradedSnapshot = {
|
||||
overall_status: "degraded",
|
||||
generated_at: "2026-04-08T08:45:00.000Z",
|
||||
|
||||
Reference in New Issue
Block a user