1
1
import type { Meta , StoryObj } from "@storybook/react" ;
2
2
import { expect , screen , userEvent , waitFor , within } from "@storybook/test" ;
3
3
import { getWorkspaceQuotaQueryKey } from "api/queries/workspaceQuota" ;
4
+ import type { Workspace , WorkspaceQuota } from "api/typesGenerated" ;
4
5
import { addHours , addMinutes } from "date-fns" ;
5
6
import {
6
7
MockOrganization ,
@@ -12,9 +13,12 @@ import {
12
13
import { withDashboardProvider } from "testHelpers/storybook" ;
13
14
import { WorkspaceTopbar } from "./WorkspaceTopbar" ;
14
15
15
- // We want a workspace without a deadline to not pollute the screenshot
16
- const baseWorkspace = {
16
+ // We want a workspace without a deadline to not pollute the screenshot. Also
17
+ // want to make sure that the workspace is synced to our other mock values
18
+ const baseWorkspace : Workspace = {
17
19
...MockWorkspace ,
20
+ organization_name : MockOrganization . name ,
21
+ organization_id : MockOrganization . id ,
18
22
latest_build : {
19
23
...MockWorkspace . latest_build ,
20
24
deadline : undefined ,
@@ -263,8 +267,9 @@ export const WithFarAwayDeadlineRequiredByTemplate: Story = {
263
267
} ,
264
268
} ;
265
269
266
- export const WithQuota : Story = {
270
+ export const WithQuotaNoOrgs : Story = {
267
271
parameters : {
272
+ showOrganizations : false ,
268
273
queries : [
269
274
{
270
275
key : getWorkspaceQuotaQueryKey (
@@ -274,7 +279,25 @@ export const WithQuota: Story = {
274
279
data : {
275
280
credits_consumed : 2 ,
276
281
budget : 40 ,
277
- } ,
282
+ } satisfies WorkspaceQuota ,
283
+ } ,
284
+ ] ,
285
+ } ,
286
+ } ;
287
+
288
+ export const WithQuotaWithOrgs : Story = {
289
+ parameters : {
290
+ showOrganizations : true ,
291
+ queries : [
292
+ {
293
+ key : getWorkspaceQuotaQueryKey (
294
+ MockOrganization . name ,
295
+ MockUser . username ,
296
+ ) ,
297
+ data : {
298
+ credits_consumed : 2 ,
299
+ budget : 40 ,
300
+ } satisfies WorkspaceQuota ,
278
301
} ,
279
302
] ,
280
303
} ,
0 commit comments