From 196352f84cfaaef38994caffa436e70859aaf77f Mon Sep 17 00:00:00 2001 From: Hiep Le <69354317+hieptl@users.noreply.github.com> Date: Wed, 10 Jun 2026 19:48:50 +0700 Subject: [PATCH] chore: remove dead test artifacts (#1229) --- .../components/terminal/terminal.test.tsx | 128 ------------------ __tests__/fixtures/library-consumer-smoke.tsx | 23 ---- tsconfig.json | 1 - 3 files changed, 152 deletions(-) delete mode 100644 __tests__/components/terminal/terminal.test.tsx delete mode 100644 __tests__/fixtures/library-consumer-smoke.tsx diff --git a/__tests__/components/terminal/terminal.test.tsx b/__tests__/components/terminal/terminal.test.tsx deleted file mode 100644 index ae25748a8b..0000000000 --- a/__tests__/components/terminal/terminal.test.tsx +++ /dev/null @@ -1,128 +0,0 @@ -import { act, screen } from "@testing-library/react"; -import { renderWithProviders } from "test-utils"; -import { vi, describe, afterEach, it, expect } from "vitest"; -import { Command, useCommandStore } from "#/stores/command-store"; -import Terminal from "#/components/features/terminal/terminal"; - -const renderTerminal = (commands: Command[] = []) => { - // Set initial commands in Zustand store - useCommandStore.setState({ commands }); - return renderWithProviders(); -}; - -describe.skip("Terminal", () => { - // Terminal is now read-only - no user input functionality - global.ResizeObserver = vi.fn().mockImplementation(() => ({ - observe: vi.fn(), - disconnect: vi.fn(), - })); - - const mockTerminal = { - open: vi.fn(), - write: vi.fn(), - writeln: vi.fn(), - dispose: vi.fn(), - loadAddon: vi.fn(), - }; - - vi.mock("@xterm/xterm", async (importOriginal) => ({ - ...(await importOriginal()), - Terminal: vi.fn().mockImplementation(() => mockTerminal), - })); - - afterEach(() => { - vi.clearAllMocks(); - }); - - it("should render a terminal", () => { - renderTerminal(); - - expect(screen.getByText("Terminal")).toBeInTheDocument(); - expect(mockTerminal.open).toHaveBeenCalledTimes(1); - - expect(mockTerminal.write).toHaveBeenCalledWith("$ "); - }); - - it("should load commands to the terminal", () => { - renderTerminal([ - { type: "input", content: "INPUT" }, - { type: "output", content: "OUTPUT" }, - ]); - - expect(mockTerminal.writeln).toHaveBeenNthCalledWith(1, "INPUT"); - expect(mockTerminal.writeln).toHaveBeenNthCalledWith(2, "OUTPUT"); - }); - - it("should write commands to the terminal", () => { - renderTerminal(); - - act(() => { - useCommandStore.getState().appendInput("echo Hello"); - useCommandStore.getState().appendOutput("Hello"); - }); - - expect(mockTerminal.writeln).toHaveBeenNthCalledWith(1, "echo Hello"); - expect(mockTerminal.writeln).toHaveBeenNthCalledWith(2, "Hello"); - - act(() => { - useCommandStore.getState().appendInput("echo World"); - }); - - expect(mockTerminal.writeln).toHaveBeenNthCalledWith(3, "echo World"); - }); - - it("should load and write commands to the terminal", () => { - renderTerminal([ - { type: "input", content: "echo Hello" }, - { type: "output", content: "Hello" }, - ]); - - expect(mockTerminal.writeln).toHaveBeenNthCalledWith(1, "echo Hello"); - expect(mockTerminal.writeln).toHaveBeenNthCalledWith(2, "Hello"); - - act(() => { - useCommandStore.getState().appendInput("echo Hello"); - }); - - expect(mockTerminal.writeln).toHaveBeenNthCalledWith(3, "echo Hello"); - }); - - it("should end the line with a dollar sign after writing a command", () => { - renderTerminal(); - - act(() => { - useCommandStore.getState().appendInput("echo Hello"); - }); - - expect(mockTerminal.writeln).toHaveBeenCalledWith("echo Hello"); - expect(mockTerminal.write).toHaveBeenCalledWith("$ "); - }); - - it("should display a custom symbol if output contains a custom symbol", () => { - renderTerminal([ - { type: "input", content: "echo Hello" }, - { - type: "output", - content: - "Hello\r\n\r\n[Python Interpreter: /openhands/poetry/openhands-5O4_aCHf-py3.12/bin/python]\nopenhands@659478cb008c:/workspace $ ", - }, - ]); - - expect(mockTerminal.writeln).toHaveBeenNthCalledWith(1, "echo Hello"); - expect(mockTerminal.writeln).toHaveBeenNthCalledWith(2, "Hello"); - expect(mockTerminal.write).toHaveBeenCalledWith( - "\nopenhands@659478cb008c:/workspace $ ", - ); - }); - - // This test fails because it expects `disposeMock` to have been called before the component is unmounted. - it.skip("should dispose the terminal on unmount", () => { - const { unmount } = renderWithProviders(); - - expect(mockTerminal.dispose).not.toHaveBeenCalled(); - - unmount(); - - expect(mockTerminal.dispose).toHaveBeenCalledTimes(1); - }); -}); diff --git a/__tests__/fixtures/library-consumer-smoke.tsx b/__tests__/fixtures/library-consumer-smoke.tsx deleted file mode 100644 index a74d580ac4..0000000000 --- a/__tests__/fixtures/library-consumer-smoke.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { - AgentServerUIProviders, - BrowserPanel, - ConversationView, - SettingsPanel, - TerminalPanel, -} from "@openhands/agent-canvas"; -import { LLMSettings } from "@openhands/agent-canvas/settings"; -import { Sidebar } from "@openhands/agent-canvas/sidebar"; - -export function SmokeImportConsumer() { - return ( - - - - - - - - - - ); -} diff --git a/tsconfig.json b/tsconfig.json index 2d3af9f2bf..ef211e41eb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,6 @@ "**/.client/**/*.tsx", ".react-router/types/**/*" ], - "exclude": ["__tests__/fixtures/**/*"], "compilerOptions": { "lib": ["dom", "dom.iterable", "es2022"], "target": "es2022",