Add a Clear Screen button by iBug · Pull Request #8121 · mitmproxy/mitmproxy

I cannot directly modify this PR because you didn’t enable edits for maintainers, but I noticed that the icon you proposed doesn’t work. I would suggest simply sticking with a trash icon.
Regarding the test, you can update MainMenuSpec.tsx with something like this:

import * as React from "react";
import FlowListMenu, {
    ClearAll,
} from "../../../components/Header/FlowListMenu";
import { fireEvent, render, screen } from "../../test-utils";
import { enableFetchMocks } from "jest-fetch-mock";

enableFetchMocks();

test("MainMenu", () => {
    const { asFragment } = render(<FlowListMenu />);
    expect(asFragment()).toMatchSnapshot();
});

test("ClearAll dispatches clear action", async () => {
    fetchMock.mockOnce("", { status: 200 });

    render(<ClearAll />);
    fireEvent.click(screen.getByText("Clear All"));

    expect(fetchMock).toHaveBeenCalledWith(
        expect.stringContaining("/clear"),
        expect.objectContaining({ method: "POST" }),
    );
});