Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
test(update): render tests for the TopBar update button
Ruben Lütke7b299fb2a77d
diff --git a/jarvis/ui/web/frontend/src/__tests__/topbarUpdateButton.test.tsx b/jarvis/ui/web/frontend/src/__tests__/topbarUpdateButton.test.tsxnew file mode 100644index 0000000000..ec7ba46b9c--- /dev/null+++ b/jarvis/ui/web/frontend/src/__tests__/topbarUpdateButton.test.tsx@@ -0,0 +1,75 @@+/**+ * The TopBar update button: it renders ONLY when the backend reports a managed+ * install with an available update, shows the new version, and stays hidden on+ * an unmanaged checkout (the dev-tree safety guard surfaced in the UI).+ */+import { cleanup, render, screen, waitFor } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";++import { TopBar } from "@/components/layout/TopBar";+import { useEventStore } from "@/store/events";++function mockUpdateStatus(body: Record<string, unknown>): void {+ vi.stubGlobal(+ "fetch",+ vi.fn(async (url: string) => {+ if (typeof url === "string" && url.startsWith("/api/update/status")) {+ return { ok: true, status: 200, json: async () => body };+ }+ return { ok: true, status: 200, json: async () => ({}) };+ }),+ );+}++describe("TopBar update button", () => {+ beforeEach(() => {+ useEventStore.setState({ assistantName: "Assistant" });+ });+ afterEach(() => {+ cleanup();+ vi.unstubAllGlobals();+ });++ it("shows the Update button with the new version when an update is available", async () => {+ mockUpdateStatus({+ managed: true,+ current: "1.0.1",+ latest: "1.0.2",+ update_available: true,+ notes: "Fixes and improvements",+ published_at: null,+ });+ render(<TopBar />);+ await waitFor(() => expect(screen.getByText("Update available")).toBeTruthy());+ expect(screen.getByText("v1.0.2")).toBeTruthy();+ });++ it("hides the Update button on an unmanaged checkout (dev-tree guard)", async () => {+ mockUpdateStatus({+ managed: false,+ current: "1.0.1",+ latest: null,+ update_available: false,+ notes: null,+ published_at: null,+ });+ render(<TopBar />);+ // The restart button always renders; the update button must not.+ await waitFor(() => expect(screen.getByText("Restart")).toBeTruthy());+ expect(screen.queryByText("Update available")).toBeNull();+ });++ it("hides the Update button when the managed install is already up to date", async () => {+ mockUpdateStatus({+ managed: true,+ current: "1.0.2",+ latest: "1.0.2",+ update_available: false,+ notes: null,+ published_at: null,+ });+ render(<TopBar />);+ await waitFor(() => expect(screen.getByText("Restart")).toBeTruthy());+ expect(screen.queryByText("Update available")).toBeNull();+ });+});