refactor: make browser workspace writes bootstrap-only
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { CanonicalWorkspace, WorkspaceRevision } from "../api/workspaces";
|
||||
import type { CanonicalWorkspace, WorkspaceRevision, WorkspaceSummary } from "../api/workspaces";
|
||||
|
||||
export function canonicalWorkspaceFixture(
|
||||
id: string,
|
||||
@@ -29,3 +29,25 @@ export function workspaceRevisionFixture(id: string): WorkspaceRevision {
|
||||
snapshotPath: `/snapshots/${"a".repeat(40)}/${id}.yaml`,
|
||||
};
|
||||
}
|
||||
|
||||
export function workspaceSummaryFixture(
|
||||
id: string,
|
||||
options: {
|
||||
displayName?: string;
|
||||
description?: string;
|
||||
configurationState?: WorkspaceSummary["configurationState"];
|
||||
revision?: WorkspaceRevision;
|
||||
} = {},
|
||||
): WorkspaceSummary {
|
||||
const configurationState = options.configurationState ?? "ready";
|
||||
const revision = options.revision ?? (configurationState === "ready" ? workspaceRevisionFixture(id) : undefined);
|
||||
return {
|
||||
id,
|
||||
name: id,
|
||||
file: `${id}/workspace.yaml`,
|
||||
displayName: options.displayName ?? id,
|
||||
...(options.description === undefined ? {} : { description: options.description }),
|
||||
configurationState,
|
||||
...(revision ? { revision } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user