Skip to content

Commit 47a88f7

Browse files
committed
Refactor story to match connected
1 parent f76800c commit 47a88f7

File tree

1 file changed

+32
-24
lines changed

1 file changed

+32
-24
lines changed

site/src/pages/TerminalPage/TerminalPage.stories.tsx

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { workspaceByOwnerAndNameKey } from "api/queries/workspaces";
2222
import { Workspace } from "api/typesGenerated";
2323
import { withWebSocket } from "testHelpers/storybook";
2424

25-
const meta: Meta<typeof TerminalPage> = {
25+
const meta = {
2626
title: "pages/Terminal",
2727
component: RequireAuth,
2828
parameters: {
@@ -49,6 +49,37 @@ const meta: Meta<typeof TerminalPage> = {
4949
{ key: ["entitlements"], data: MockEntitlements },
5050
{ key: ["experiments"], data: MockExperiments },
5151
{ key: ["appearance"], data: MockAppearanceConfig },
52+
53+
{
54+
key: getAuthorizationKey({ checks: permissionsToCheck }),
55+
data: { editWorkspaceProxies: true },
56+
},
57+
],
58+
},
59+
decorators: [
60+
(Story) => (
61+
<AuthProvider>
62+
<Story />
63+
</AuthProvider>
64+
),
65+
],
66+
} satisfies Meta<typeof TerminalPage>;
67+
68+
export default meta;
69+
type Story = StoryObj<typeof TerminalPage>;
70+
71+
export const Connected: Story = {
72+
decorators: [withWebSocket],
73+
parameters: {
74+
...meta.parameters,
75+
webSocket: {
76+
// Copied and pasted this from browser
77+
messages: [
78+
`➜ codergit:(bq/refactor-web-term-notifications) ✗`,
79+
],
80+
},
81+
queries: [
82+
...meta.parameters.queries,
5283
{
5384
key: workspaceByOwnerAndNameKey(
5485
MockWorkspace.owner_name,
@@ -67,29 +98,6 @@ const meta: Meta<typeof TerminalPage> = {
6798
},
6899
} satisfies Workspace,
69100
},
70-
{
71-
key: getAuthorizationKey({ checks: permissionsToCheck }),
72-
data: { editWorkspaceProxies: true },
73-
},
74101
],
75-
webSocket: {
76-
// Copied and pasted this from browser
77-
messages: [
78-
`➜ codergit:(bq/refactor-web-term-notifications) ✗`,
79-
],
80-
},
81102
},
82-
decorators: [
83-
(Story) => (
84-
<AuthProvider>
85-
<Story />
86-
</AuthProvider>
87-
),
88-
withWebSocket,
89-
],
90103
};
91-
92-
export default meta;
93-
type Story = StoryObj<typeof TerminalPage>;
94-
95-
export const Default: Story = {};

0 commit comments

Comments
 (0)