diff --git a/src/shared/schemas/qdrant.ts b/src/shared/schemas/qdrant.ts index 744ec41bfe47..09f78c502d75 100644 --- a/src/shared/schemas/qdrant.ts +++ b/src/shared/schemas/qdrant.ts @@ -37,8 +37,3 @@ export const QdrantHealthResultSchema = z.object({ latencyMs: z.number(), error: z.string().optional(), }); - -export type QdrantSettings = z.infer; -export type QdrantSettingsUpdate = z.infer; -export type QdrantSearch = z.infer; -export type QdrantHealthResult = z.infer; diff --git a/tests/unit/qdrant-schemas.test.ts b/tests/unit/qdrant-schemas.test.ts new file mode 100644 index 000000000000..ec29e09a2376 --- /dev/null +++ b/tests/unit/qdrant-schemas.test.ts @@ -0,0 +1,35 @@ +import test from "node:test"; +import assert from "node:assert/strict"; + +import { + QdrantHealthResultSchema, + QdrantSearchSchema, + QdrantSettingsSchema, + QdrantSettingsUpdateSchema, +} from "../../src/shared/schemas/qdrant.ts"; + +test("qdrant schema module keeps runtime request and response schemas exported", () => { + assert.equal(typeof QdrantSettingsSchema.safeParse, "function"); + assert.equal(typeof QdrantSettingsUpdateSchema.safeParse, "function"); + assert.equal(typeof QdrantSearchSchema.safeParse, "function"); + assert.equal(typeof QdrantHealthResultSchema.safeParse, "function"); +}); + +test("QdrantSettingsUpdateSchema validates partial updates", () => { + const result = QdrantSettingsUpdateSchema.safeParse({ + enabled: true, + host: "qdrant.local", + port: 6334, + }); + + assert.equal(result.success, true); +}); + +test("QdrantSearchSchema applies the default topK", () => { + const result = QdrantSearchSchema.safeParse({ query: "semantic search" }); + + assert.equal(result.success, true); + if (result.success) { + assert.equal(result.data.topK, 5); + } +});