diff --git a/src/app/machines/views/MachineDetails/MachineHeader/MachineHeader.test.tsx b/src/app/machines/views/MachineDetails/MachineHeader/MachineHeader.test.tsx index d5c5d232e1..0c2707696a 100644 --- a/src/app/machines/views/MachineDetails/MachineHeader/MachineHeader.test.tsx +++ b/src/app/machines/views/MachineDetails/MachineHeader/MachineHeader.test.tsx @@ -6,7 +6,7 @@ import MachineHeader from "./MachineHeader"; import { actions as machineActions } from "app/store/machine"; import type { RootState } from "app/store/root/types"; import { PowerState } from "app/store/types/enum"; -import { NodeActions, NodeStatusCode } from "app/store/types/node"; +import { NodeActions, NodeStatus, NodeStatusCode } from "app/store/types/node"; import { generalState as generalStateFactory, machine as machineFactory, @@ -84,15 +84,29 @@ describe("MachineHeader", () => { ); }); - it("displays power status", () => { - state.machine.items[0].power_state = PowerState.ON; + it("displays an icon when locked", () => { + state.machine.items[0].locked = true; + + renderWithBrowserRouter( + , + { state, route: "/machine/abc123" } + ); + + expect(screen.getByRole("button", { name: /locked/i })).toBeInTheDocument(); + expect(screen.getByRole("button", { name: /locked/i })).toHaveClass( + "has-icon" + ); + }); + + it("displays machine status", () => { + state.machine.items[0].status = NodeStatus.DEPLOYED; renderWithBrowserRouter( , { state, route: "/machine/abc123" } ); - expect(screen.getByText(/power on/i)).toBeInTheDocument(); + expect(screen.getByText(/deployed/i)).toBeInTheDocument(); }); it("displays power status when checking power", () => { diff --git a/src/app/machines/views/MachineDetails/MachineHeader/MachineHeader.tsx b/src/app/machines/views/MachineDetails/MachineHeader/MachineHeader.tsx index ec540baa68..b1915c007f 100644 --- a/src/app/machines/views/MachineDetails/MachineHeader/MachineHeader.tsx +++ b/src/app/machines/views/MachineDetails/MachineHeader/MachineHeader.tsx @@ -92,7 +92,7 @@ const MachineHeader = ({ subtitle={ editingName ? null : (
-
+
{machine.locked ? ( ) : null} + {machine.status}