feat(web): redirect /fleet to Dashboard; update fleet tests

/fleet now redirects to / so bookmarks and muscle-memory links land on the
unified Dashboard rather than a 404-style dead route. Fleet tests updated
to assert the redirect and the per-instance rows the Dashboard renders.
This commit is contained in:
Offending Commit
2026-06-03 17:10:02 -05:00
parent 699ec38480
commit da126b2e74
2 changed files with 9 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
import { createFileRoute } from "@tanstack/react-router";
import { FleetDashboard } from "@/components/fleet/FleetDashboard";
import { createFileRoute, redirect } from "@tanstack/react-router";
export const Route = createFileRoute("/fleet")({
component: FleetDashboard,
beforeLoad: () => {
throw redirect({ to: "/" });
},
});

View File

@@ -155,21 +155,18 @@ describe("Fleet route", () => {
localStorage.clear();
});
it("mounts FleetDashboard at /fleet when an instance is configured", async () => {
it("redirects /fleet to the Dashboard", async () => {
saveStore({ instances: [neo], activeId: "neo" });
renderRouteAt("/fleet");
expect(await screen.findByRole("heading", { name: /Fleet/i })).toBeInTheDocument();
expect(await screen.findByRole("heading", { name: "Dashboard" })).toBeInTheDocument();
});
it("renders one table row per configured instance", async () => {
it("shows each instance after /fleet redirect", async () => {
saveStore({ instances: [neo, iris], activeId: "neo" });
renderRouteAt("/fleet");
const table = await screen.findByRole("table");
await waitFor(() => {
expect(within(table).getByText("Neo")).toBeInTheDocument();
expect(within(table).getByText("Iris")).toBeInTheDocument();
expect(screen.getByText("Neo — no workspaces")).toBeInTheDocument();
expect(screen.getByText("Iris — no workspaces")).toBeInTheDocument();
});
// 1 header + 2 instance rows
expect(within(table).getAllByRole("row")).toHaveLength(3);
});
});