mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
refactor(frontend): Remove test todos and fix light warning (#5554)
This commit is contained in:
parent
4a8bf3d2d0
commit
d62cf7e731
@ -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");
|
||||
|
||||
@ -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");
|
||||
});
|
||||
});
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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",
|
||||
);
|
||||
});
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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 () => {},
|
||||
);
|
||||
});
|
||||
|
||||
@ -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");
|
||||
});
|
||||
@ -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");
|
||||
});
|
||||
@ -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");
|
||||
});
|
||||
@ -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",
|
||||
);
|
||||
});
|
||||
@ -1,5 +0,0 @@
|
||||
import { describe, it } from "vitest";
|
||||
|
||||
describe("App", () => {
|
||||
it.todo("should render");
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user