File size: 711 Bytes
287a0bc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { expect, test } from "@jest/globals";
import chroma from "./initClient";
import { EMBEDDINGS, IDS, METADATAS } from "./data";

test("it should delete a collection", async () => {
  await chroma.reset();
  const collection = await chroma.createCollection({ name: "test" });
  await collection.add({ ids: IDS, embeddings: EMBEDDINGS, metadatas: METADATAS });
  let count = await collection.count();
  expect(count).toBe(3);
  var resp = await collection.delete({ where: { test: "test1" } });
  count = await collection.count();
  expect(count).toBe(2);

  var remainingEmbeddings = await collection.get();
  expect(["test2", "test3"]).toEqual(
    expect.arrayContaining(remainingEmbeddings.ids)
  );
});