Skip to content
Prev Previous commit
Next Next commit
Add basic test
  • Loading branch information
f0ssel committed Feb 20, 2024
commit d3927f05476e2b83e3c8777bca1b478d204508ab
33 changes: 33 additions & 0 deletions site/src/modules/resources/PortForwardPopoverView.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { screen } from "@testing-library/react";
import { MockListeningPortsResponse, MockTemplate, MockWorkspace, MockWorkspaceAgent } from "testHelpers/entities";
import { renderComponent } from "testHelpers/renderHelpers";
import { PortForwardPopoverView } from "./PortForwardButton";
import { QueryClientProvider, QueryClient } from "react-query";

describe("Port Forward Popover View", () => {
it("renders component", async () => {
renderComponent(
<QueryClientProvider client={new QueryClient()}>
<PortForwardPopoverView
agent={MockWorkspaceAgent}
template={MockTemplate}
workspaceID={MockWorkspace.id}
listeningPorts={MockListeningPortsResponse.ports}
portSharingExperimentEnabled
portSharingControlsEnabled
host="host"
username="username"
workspaceName="workspaceName"
/>
</QueryClientProvider>
);

expect(
screen.getByText(MockListeningPortsResponse.ports[0].port),
).toBeInTheDocument();

expect(
screen.getByText(MockListeningPortsResponse.ports[0].process_name),
).toBeInTheDocument();
});
});