Files
2026-07-13 13:09:14 +08:00

24 lines
745 B
TypeScript
Vendored

import assert from "node:assert/strict";
import { test } from "vitest";
import { collectionListToTableInfos } from "../src/database.js";
test("maps legacy collection name responses to table infos", () => {
assert.deepEqual(collectionListToTableInfos(["projects", "users"]), [
{ name: "projects", type: "COLLECTION" },
{ name: "users", type: "COLLECTION" },
]);
});
test("maps collection info responses to table infos", () => {
assert.deepEqual(
collectionListToTableInfos([
{ name: "projects", id: "projects", dimension: null },
{ name: "embeddings", id: "uuid-123", dimension: 384 },
]),
[
{ name: "projects", type: "COLLECTION" },
{ name: "embeddings", type: "COLLECTION" },
],
);
});