Skip to content

chore(site): add storybook for terminal page #12441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 7, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor story to match connected
  • Loading branch information
BrunoQuaresma committed Mar 5, 2024
commit 47a88f7278f7c8006a7a17427833de521b4dd48d
56 changes: 32 additions & 24 deletions site/src/pages/TerminalPage/TerminalPage.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { workspaceByOwnerAndNameKey } from "api/queries/workspaces";
import { Workspace } from "api/typesGenerated";
import { withWebSocket } from "testHelpers/storybook";

const meta: Meta<typeof TerminalPage> = {
const meta = {
title: "pages/Terminal",
component: RequireAuth,
parameters: {
Expand All @@ -49,6 +49,37 @@ const meta: Meta<typeof TerminalPage> = {
{ key: ["entitlements"], data: MockEntitlements },
{ key: ["experiments"], data: MockExperiments },
{ key: ["appearance"], data: MockAppearanceConfig },

{
key: getAuthorizationKey({ checks: permissionsToCheck }),
data: { editWorkspaceProxies: true },
},
],
},
decorators: [
(Story) => (
<AuthProvider>
<Story />
</AuthProvider>
),
],
} satisfies Meta<typeof TerminalPage>;

export default meta;
type Story = StoryObj<typeof TerminalPage>;

export const Connected: Story = {
decorators: [withWebSocket],
parameters: {
...meta.parameters,
webSocket: {
// Copied and pasted this from browser
messages: [
`➜ codergit:(bq/refactor-web-term-notifications) ✗`,
],
},
queries: [
...meta.parameters.queries,
{
key: workspaceByOwnerAndNameKey(
MockWorkspace.owner_name,
Expand All @@ -67,29 +98,6 @@ const meta: Meta<typeof TerminalPage> = {
},
} satisfies Workspace,
},
{
key: getAuthorizationKey({ checks: permissionsToCheck }),
data: { editWorkspaceProxies: true },
},
],
webSocket: {
// Copied and pasted this from browser
messages: [
`➜ codergit:(bq/refactor-web-term-notifications) ✗`,
],
},
},
decorators: [
(Story) => (
<AuthProvider>
<Story />
</AuthProvider>
),
withWebSocket,
],
};

export default meta;
type Story = StoryObj<typeof TerminalPage>;

export const Default: Story = {};