test: use canonical workspace API fixtures
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user