test: use canonical workspace API fixtures

This commit is contained in:
2026-08-09 20:44:35 +02:00
parent a681c431fb
commit d77c08884b
4 changed files with 51 additions and 13 deletions
+34
View File
@@ -0,0 +1,34 @@
import type { CanonicalWorkspace, WorkspaceRevision } from "../api/workspaces";
export function canonicalWorkspaceFixture(
id: string,
allowed: `${string}/${string}`[] = ["zai/glm-5.2"],
defaultModel?: `${string}/${string}`,
): CanonicalWorkspace {
return {
workspace: { schema_version: 3, id, name: id, language: "en" },
dwh: {
engine: "postgres", database: "database", schema: "public",
supported_transports: ["postgres_direct"],
},
semantic_index: {
vector_store: {
engine: "qdrant", collection: id.replaceAll("-", "_"), dimensions: 1024, distance: "cosine",
},
embedding: {
provider: "ollama_internal", model: "qwen3-embedding:0.6b", dimensions: 1024,
},
},
llm_policy: { ...(defaultModel ? { default: defaultModel } : {}), allowed },
};
}
export function workspaceRevisionFixture(
id: string,
state: WorkspaceRevision["state"] = "operational",
): WorkspaceRevision {
return {
id, commit: "a".repeat(40), blob: "b".repeat(40),
snapshotPath: `/snapshots/${"a".repeat(40)}/${id}.yaml`, state,
};
}