(queryClient: QueryClient)
| 31 | } satisfies WorkspacesResponse; |
| 32 | |
| 33 | const seedWorkspaceFamilyQueries = (queryClient: QueryClient) => { |
| 34 | const rawListKey = workspacesQueryKeyPrefix; |
| 35 | const defaultListKey = workspacesKey({}); |
| 36 | const filteredListKey = workspacesKey({ |
| 37 | q: "owner:me organization:default", |
| 38 | limit: 25, |
| 39 | offset: 50, |
| 40 | }); |
| 41 | const usageKey = workspaceUsage({ |
| 42 | usageApp: "reconnecting-pty", |
| 43 | connectionStatus: "connected", |
| 44 | workspaceId: "workspace-1", |
| 45 | agentId: "agent-1", |
| 46 | }).queryKey; |
| 47 | const buildLogs = buildLogsKey("workspace-1"); |
| 48 | const workspacePermissionsKey = [ |
| 49 | "workspaces", |
| 50 | "workspace-1", |
| 51 | "permissions", |
| 52 | ] as const; |
| 53 | const workspaceAgentCredentialsKey = [ |
| 54 | "workspaces", |
| 55 | "workspace-1", |
| 56 | "agents", |
| 57 | "main", |
| 58 | "credentials", |
| 59 | ] as const; |
| 60 | const organizationWorkspacePermissionsKey = [ |
| 61 | "workspaces", |
| 62 | ["organization-1"], |
| 63 | "permissions", |
| 64 | ] as const; |
| 65 | |
| 66 | queryClient.setQueryData(rawListKey, workspacesResponse); |
| 67 | queryClient.setQueryData(defaultListKey, workspacesResponse); |
| 68 | queryClient.setQueryData(filteredListKey, workspacesResponse); |
| 69 | queryClient.setQueryData(usageKey, { tracked: true }); |
| 70 | queryClient.setQueryData(buildLogs, []); |
| 71 | queryClient.setQueryData(workspacePermissionsKey, { read: true }); |
| 72 | queryClient.setQueryData(workspaceAgentCredentialsKey, { token: "secret" }); |
| 73 | queryClient.setQueryData(organizationWorkspacePermissionsKey, { read: true }); |
| 74 | |
| 75 | return { |
| 76 | listKeys: [rawListKey, defaultListKey, filteredListKey], |
| 77 | nonListKeys: [ |
| 78 | usageKey, |
| 79 | buildLogs, |
| 80 | workspacePermissionsKey, |
| 81 | workspaceAgentCredentialsKey, |
| 82 | organizationWorkspacePermissionsKey, |
| 83 | ], |
| 84 | }; |
| 85 | }; |
| 86 | |
| 87 | describe("invalidateWorkspaceListQueries", () => { |
| 88 | it("invalidates workspace list queries without touching side-effecting workspace-family queries", async () => { |
no test coverage detected