From 4b6a95813620e9f6517131db6730f24d665c8bed Mon Sep 17 00:00:00 2001 From: Hammad Bashir Date: Mon, 29 Apr 2024 23:48:35 -0700 Subject: [PATCH] [CLN] Run prettier to make linter happy (#2081) ## Description of changes *Summarize the changes made by this PR.* - Improvements & Bug fixes - Ran prettier to fix breakage lint rule breakge in #2044 - New functionality - ... ## Test plan *How are these changes tested?* Lint CI failed, this is a fix - [x] Tests pass locally with `pytest` for python, `yarn test` for js, `cargo test` for rust ## Documentation Changes *Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the [docs repository](https://github.com/chroma-core/docs)?* --- clients/js/src/types.ts | 14 +++++++------- clients/js/test/get.collection.test.ts | 4 +++- clients/js/test/query.collection.test.ts | 8 +++++--- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/clients/js/src/types.ts b/clients/js/src/types.ts index 5e1aa8885a5..feba319ff71 100644 --- a/clients/js/src/types.ts +++ b/clients/js/src/types.ts @@ -32,8 +32,8 @@ type WhereOperator = "$gt" | "$gte" | "$lt" | "$lte" | "$ne" | "$eq"; type OperatorExpression = { [key in WhereOperator | InclusionOperator | LogicalOperator]?: - | LiteralValue - | ListLiteralValue; + | LiteralValue + | ListLiteralValue; }; type BaseWhere = { @@ -50,9 +50,9 @@ type WhereDocumentOperator = "$contains" | "$not_contains" | LogicalOperator; export type WhereDocument = { [key in WhereDocumentOperator]?: - | LiteralValue - | LiteralNumber - | WhereDocument[]; + | LiteralValue + | LiteralNumber + | WhereDocument[]; }; export type CollectionType = { @@ -67,7 +67,7 @@ export type GetResponse = { documents: (null | Document)[]; metadatas: (null | Metadata)[]; error: null | string; - included: IncludeEnum[] + included: IncludeEnum[]; }; export type QueryResponse = { @@ -76,7 +76,7 @@ export type QueryResponse = { documents: (null | Document)[][]; metadatas: (null | Metadata)[][]; distances: null | number[][]; - included: IncludeEnum[] + included: IncludeEnum[]; }; export type AddResponse = { diff --git a/clients/js/test/get.collection.test.ts b/clients/js/test/get.collection.test.ts index 805b3819264..2bfd4fae789 100644 --- a/clients/js/test/get.collection.test.ts +++ b/clients/js/test/get.collection.test.ts @@ -17,7 +17,9 @@ test("it should get a collection", async () => { expect(results.ids.length).toBe(1); expect(["test1"]).toEqual(expect.arrayContaining(results.ids)); expect(["test2"]).not.toEqual(expect.arrayContaining(results.ids)); - expect(results.included).toEqual(expect.arrayContaining(["metadatas", "documents"])) + expect(results.included).toEqual( + expect.arrayContaining(["metadatas", "documents"]), + ); const results2 = await collection.get({ where: { test: "test1" } }); expect(results2).toBeDefined(); diff --git a/clients/js/test/query.collection.test.ts b/clients/js/test/query.collection.test.ts index 4afb0120ca3..41adff61ba6 100644 --- a/clients/js/test/query.collection.test.ts +++ b/clients/js/test/query.collection.test.ts @@ -6,7 +6,7 @@ import { EMBEDDINGS, IDS, METADATAS, DOCUMENTS } from "./data"; import { IEmbeddingFunction } from "../src/embeddings/IEmbeddingFunction"; export class TestEmbeddingFunction implements IEmbeddingFunction { - constructor() { } + constructor() {} public async generate(texts: string[]): Promise { let embeddings: number[][] = []; @@ -29,7 +29,9 @@ test("it should query a collection", async () => { expect(results).toBeInstanceOf(Object); expect(["test1", "test2"]).toEqual(expect.arrayContaining(results.ids[0])); expect(["test3"]).not.toEqual(expect.arrayContaining(results.ids[0])); - expect(results.included).toEqual(expect.arrayContaining(["metadatas", "documents"])) + expect(results.included).toEqual( + expect.arrayContaining(["metadatas", "documents"]), + ); }); // test where_document @@ -69,7 +71,7 @@ test("it should get embedding with matching documents", async () => { // expect(results2.embeddings[0][0]).toBeInstanceOf(Array); expect(results2.embeddings![0].length).toBe(1); expect(results2.embeddings![0][0]).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); - expect(results2.included).toEqual(expect.arrayContaining(["embeddings"])) + expect(results2.included).toEqual(expect.arrayContaining(["embeddings"])); }); test("it should exclude documents matching - not_contains", async () => {