π OpenHands: AI-Driven Development
refactor(frontend): Remove test todos and fix light warning (#5554)
sp.wackd62cf7e73198
diff --git a/frontend/__tests__/components/chat-message.test.tsx b/frontend/__tests__/components/chat-message.test.tsxindex 08fd090551..0edd09d241 100644--- a/frontend/__tests__/components/chat-message.test.tsx+++ b/frontend/__tests__/components/chat-message.test.tsx@@ -26,8 +26,6 @@ describe("ChatMessage", () => {expect(screen.getByText("'Hello, World!'")).toBeInTheDocument();});- it.todo("should support markdown content");-it("should render the copy to clipboard button when the user hovers over the message", async () => {const user = userEvent.setup();render(<ChatMessage type="user" message="Hello, World!" />);@@ -50,15 +48,8 @@ describe("ChatMessage", () => {expect(navigator.clipboard.readText()).resolves.toBe("Hello, World!");});- // BUG: vi.useFakeTimers() seems to break the tests- it.todo(- "should display a checkmark for 200ms and disable the button after copying content to clipboard",- );-it("should display an error toast if copying content to clipboard fails", async () => {});- test.todo("push a toast after successfully copying content to clipboard");-it("should render a component passed as a prop", () => {function Component() {return <div data-testid="custom-component">Custom Component</div>;@@ -72,7 +63,12 @@ describe("ChatMessage", () => {});it("should apply correct styles to inline code", () => {- render(<ChatMessage type="assistant" message="Here is some `inline code` text" />);+ render(+ <ChatMessage+ type="assistant"+ message="Here is some `inline code` text"+ />,+ );const codeElement = screen.getByText("inline code");expect(codeElement.tagName.toLowerCase()).toBe("code");diff --git a/frontend/__tests__/components/chat/chat-interface.test.tsx b/frontend/__tests__/components/chat/chat-interface.test.tsxindex ed8c448831..168715f219 100644--- a/frontend/__tests__/components/chat/chat-interface.test.tsx+++ b/frontend/__tests__/components/chat/chat-interface.test.tsx@@ -9,7 +9,7 @@ import { WsClientProviderStatus } from "#/context/ws-client-provider";import { ChatInterface } from "#/components/features/chat/chat-interface";// eslint-disable-next-line @typescript-eslint/no-unused-vars-const renderChatInterface = (messages: (Message)[]) =>+const renderChatInterface = (messages: Message[]) =>renderWithProviders(<ChatInterface />);describe("Empty state", () => {@@ -195,7 +195,7 @@ describe.skip("ChatInterface", () => {expect(screen.getByTestId("chat-input")).toBeInTheDocument();});- it.todo("should call socket send when submitting a message", async () => {+ it("should call socket send when submitting a message", async () => {const user = userEvent.setup();const messages: Message[] = [];renderChatInterface(messages);@@ -240,8 +240,6 @@ describe.skip("ChatInterface", () => {);});- it.todo("should render confirmation buttons");-it("should render a 'continue' action when there are more than 2 messages and awaiting user input", () => {const messages: Message[] = [{@@ -278,7 +276,7 @@ describe.skip("ChatInterface", () => {});it("should render inline errors", () => {- const messages: (Message)[] = [+ const messages: Message[] = [{sender: "assistant",content: "Hello",@@ -402,12 +400,4 @@ describe.skip("ChatInterface", () => {expect(screen.getByTestId("feedback-actions")).toBeInTheDocument();});-- describe("feedback", () => {- it.todo("should open the feedback modal when a feedback action is clicked");- it.todo(- "should submit feedback and hide the actions when feedback is shared",- );- it.todo("should render the actions once more after new messages are added");- });});diff --git a/frontend/__tests__/components/features/waitlist-modal.test.tsx b/frontend/__tests__/components/features/waitlist-modal.test.tsxindex b1f17bd26e..d52ac6e7c9 100644--- a/frontend/__tests__/components/features/waitlist-modal.test.tsx+++ b/frontend/__tests__/components/features/waitlist-modal.test.tsx@@ -1,10 +1,18 @@import { render, screen } from "@testing-library/react";-import { it, describe, expect, vi } from "vitest";+import { it, describe, expect, vi, beforeAll, afterAll } from "vitest";import userEvent from "@testing-library/user-event";import { WaitlistModal } from "#/components/features/waitlist/waitlist-modal";import * as CaptureConsent from "#/utils/handle-capture-consent";describe("WaitlistModal", () => {+ beforeAll(() => {+ vi.stubGlobal("location", { href: "" });+ });++ afterAll(() => {+ vi.unstubAllGlobals();+ });+it("should render a tos checkbox that is unchecked by default", () => {render(<WaitlistModal ghToken={null} githubAuthUrl={null} />);const checkbox = screen.getByRole("checkbox");diff --git a/frontend/__tests__/components/file-explorer/explorer-tree.test.tsx b/frontend/__tests__/components/file-explorer/explorer-tree.test.tsxindex 84c1e911ac..3d04a3753f 100644--- a/frontend/__tests__/components/file-explorer/explorer-tree.test.tsx+++ b/frontend/__tests__/components/file-explorer/explorer-tree.test.tsx@@ -25,10 +25,4 @@ describe.skip("ExplorerTree", () => {expect(screen.queryByText("folder-1-2")).toBeInTheDocument();// TODO: make sure children don't render});-- it.todo("should render all children as collapsed when defaultOpen is false");-- it.todo(- "should maintain the expanded state of child folders when closing and opening a parent folder",- );});diff --git a/frontend/__tests__/components/file-explorer/file-explorer.test.tsx b/frontend/__tests__/components/file-explorer/file-explorer.test.tsxindex 1385ce4e53..ca7d1c6f70 100644--- a/frontend/__tests__/components/file-explorer/file-explorer.test.tsx+++ b/frontend/__tests__/components/file-explorer/file-explorer.test.tsx@@ -37,8 +37,6 @@ describe.skip("FileExplorer", () => {expect(getFilesSpy).toHaveBeenCalledTimes(1); // once for root});- it.todo("should render an empty workspace");-it("should refetch the workspace when clicking the refresh button", async () => {const user = userEvent.setup();renderFileExplorerWithRunningAgentState();@@ -87,14 +85,6 @@ describe.skip("FileExplorer", () => {expect(getFilesSpy).toHaveBeenCalled();});- it.todo("should upload files when dragging them to the explorer", () => {- // It will require too much work to mock drag logic, especially for our case- // https://github.com/testing-library/user-event/issues/440#issuecomment-685010755- // TODO: should be tested in an e2e environment such as Cypress/Playwright- });-- it.todo("should download a file");-it("should display an error toast if file upload fails", async () => {(uploadFilesSpy as Mock).mockRejectedValue(new Error());const user = userEvent.setup();diff --git a/frontend/__tests__/components/modals/settings/model-selector.test.tsx b/frontend/__tests__/components/modals/settings/model-selector.test.tsxindex 8da2fec144..f1216cae3a 100644--- a/frontend/__tests__/components/modals/settings/model-selector.test.tsx+++ b/frontend/__tests__/components/modals/settings/model-selector.test.tsx@@ -109,11 +109,4 @@ describe("ModelSelector", () => {expect(screen.getByLabelText("LLM Provider")).toHaveValue("Azure");expect(screen.getByLabelText("LLM Model")).toHaveValue("ada");});-- it.todo("should disable provider if isDisabled is true");-- it.todo(- "should display the verified models in the correct order",- async () => {},- );});diff --git a/frontend/__tests__/components/project-menu/project-menu-card.test.tsx b/frontend/__tests__/components/project-menu/project-menu-card.test.tsxdeleted file mode 100644index 40a98e6be4..0000000000--- a/frontend/__tests__/components/project-menu/project-menu-card.test.tsx+++ /dev/null@@ -1,8 +0,0 @@-import { describe, it } from "vitest";--describe("PlayMenuCard", () => {- it.todo("should render the initial project title");- it.todo("should be able to edit the project title");- it.todo("should render the menu list items when clicking the ellipses");- it.todo("should close the menu list when clicking outside");-});diff --git a/frontend/__tests__/components/settings/ai-config-form.test.tsx b/frontend/__tests__/components/settings/ai-config-form.test.tsxdeleted file mode 100644index 24cb95bf91..0000000000--- a/frontend/__tests__/components/settings/ai-config-form.test.tsx+++ /dev/null@@ -1,9 +0,0 @@-import { describe, it } from "vitest";--describe("AIConfigForm", () => {- it.todo("should render the AI config form");- it.todo("should toggle the advanced settings when clicked");- it.todo("should call the onSubmit callback when the form is submitted");- it.todo("should call the onReset callback when the reset button is clicked");- it.todo("should call the onClose callback when the close button is clicked");-});diff --git a/frontend/__tests__/components/settings/dropdown-input.test.tsx b/frontend/__tests__/components/settings/dropdown-input.test.tsxdeleted file mode 100644index 0ad6455e85..0000000000--- a/frontend/__tests__/components/settings/dropdown-input.test.tsx+++ /dev/null@@ -1,9 +0,0 @@-import { describe, it } from "vitest";--describe("DropdownInput", () => {- it.todo("should render the input");- it.todo("should render the placeholder");- it.todo("should render the dropdown when clicked");- it.todo("should select an option when clicked");- it.todo("should filter the options when typing");-});diff --git a/frontend/__tests__/components/settings/model-selector.test.tsx b/frontend/__tests__/components/settings/model-selector.test.tsxdeleted file mode 100644index dba8df580b..0000000000--- a/frontend/__tests__/components/settings/model-selector.test.tsx+++ /dev/null@@ -1,12 +0,0 @@-import { describe, it } from "vitest";--describe("ModelSelector", () => {- it.todo("should render the model selector");- it.todo("should display and select the providers");- it.todo("should display and select the models");- it.todo("should disable the models if a provider is not selected");- it.todo("should disable the inputs if isDisabled is true");- it.todo(- "should set the selected model and provider if the currentModel prop is set",- );-});diff --git a/frontend/__tests__/routes/_oh.app.test.tsx b/frontend/__tests__/routes/_oh.app.test.tsxdeleted file mode 100644index f86630152a..0000000000--- a/frontend/__tests__/routes/_oh.app.test.tsx+++ /dev/null@@ -1,5 +0,0 @@-import { describe, it } from "vitest";--describe("App", () => {- it.todo("should render");-});