Skip to content

Commit 999469f

Browse files
committed
chore(site): add stories for AgentDevcontainerCard
1 parent f8f3000 commit 999469f

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import type { Meta, StoryObj } from "@storybook/react";
2+
import { AgentDevcontainerCard } from "./AgentDevcontainerCard";
3+
import {
4+
MockWorkspace,
5+
MockWorkspaceAgentDevcontainer,
6+
MockWorkspaceAgentDevcontainerPorts,
7+
} from "testHelpers/entities";
8+
9+
const meta: Meta<typeof AgentDevcontainerCard> = {
10+
title: "modules/resources/AgentDevcontainerCard",
11+
component: AgentDevcontainerCard,
12+
args: {
13+
container: MockWorkspaceAgentDevcontainer,
14+
workspace: MockWorkspace,
15+
wildcardHostname: "*.wildcard.hostname",
16+
agentName: "dev",
17+
},
18+
};
19+
20+
export default meta;
21+
type Story = StoryObj<typeof AgentDevcontainerCard>;
22+
23+
export const NoPorts: Story = {};
24+
25+
export const WithPorts: Story = {
26+
args: {
27+
container: {
28+
...MockWorkspaceAgentDevcontainer,
29+
ports: MockWorkspaceAgentDevcontainerPorts,
30+
},
31+
},
32+
};

site/src/testHelpers/entities.ts

+43
Original file line numberDiff line numberDiff line change
@@ -4272,3 +4272,46 @@ function mockTwoDaysAgo() {
42724272
date.setDate(date.getDate() - 2);
42734273
return date.toISOString();
42744274
}
4275+
4276+
export const MockWorkspaceAgentDevcontainerPorts: TypesGen.WorkspaceAgentDevcontainerPort[] = [
4277+
{
4278+
port: 1000,
4279+
network: "tcp",
4280+
host_port: 1000,
4281+
host_ip: "0.0.0.0"
4282+
},
4283+
{
4284+
port: 2001,
4285+
network: "tcp",
4286+
host_port: 2000,
4287+
host_ip: "::1"
4288+
},
4289+
{
4290+
port: 8888,
4291+
network: "tcp",
4292+
}
4293+
]
4294+
4295+
export const MockWorkspaceAgentDevcontainer : TypesGen.WorkspaceAgentDevcontainer = {
4296+
created_at: "2024-01-04T15:53:03.21563Z",
4297+
id: "abcd1234",
4298+
name: "container-1",
4299+
image: "ubuntu:latest",
4300+
labels: {
4301+
"foo": "bar"
4302+
},
4303+
ports: [],
4304+
running: true,
4305+
status: "running",
4306+
volumes: {
4307+
"/mnt/volume1": "/volume1",
4308+
}
4309+
}
4310+
4311+
export const MockWorkspaceAgentListContainersResponse: TypesGen.WorkspaceAgentListContainersResponse =
4312+
{
4313+
containers: [
4314+
MockWorkspaceAgentDevcontainer,
4315+
],
4316+
"warnings": ["This is a warning"],
4317+
}

0 commit comments

Comments
 (0)