chroma / clients /js /test /peek.collection.test.ts
badalsahani's picture
feat: chroma initial deploy
287a0bc
raw
history blame contribute delete
577 Bytes
import { expect, test } from "@jest/globals";
import chroma from "./initClient";
import { IDS, EMBEDDINGS } from "./data";
test("it should peek a collection", async () => {
await chroma.reset();
const collection = await chroma.createCollection({ name: "test" });
await collection.add({ ids: IDS, embeddings: EMBEDDINGS });
const results = await collection.peek({ limit: 2 });
expect(results).toBeDefined();
expect(results).toBeInstanceOf(Object);
expect(results.ids.length).toBe(2);
expect(["test1", "test2"]).toEqual(expect.arrayContaining(results.ids));
});