From 3e35ca3bd4e4fb31292b51ad24b5fd52be16079d Mon Sep 17 00:00:00 2001 From: Nimra Khalid Date: Wed, 29 Jul 2026 23:01:43 +0500 Subject: [PATCH] Fix vacuous-pass assertion in collection.config schema/EF conflict test "it should error if both schema and embedding function are provided" wrapped its assertion inside the catch block with no fallback: if createCollection() didn't throw, the catch body (and its expect(error).toBeDefined() check) never ran, and the test passed silently without ever exercising the assertion. Rewritten as await expect(...).rejects.toBeDefined(), matching the pattern applied in #7508/#7509/#7525. Flagged by review on #7525: https://github.com/chroma-core/chroma/pull/7525#pullrequestreview Addresses #2801 --- .../chromadb/test/collection.config.client.test.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/clients/new-js/packages/chromadb/test/collection.config.client.test.ts b/clients/new-js/packages/chromadb/test/collection.config.client.test.ts index 011820b5255..577181470fe 100644 --- a/clients/new-js/packages/chromadb/test/collection.config.client.test.ts +++ b/clients/new-js/packages/chromadb/test/collection.config.client.test.ts @@ -611,15 +611,13 @@ describe("embedding function null vs undefined handling", () => { const schema = new Schema(); const providedEf = new DefaultSpaceCustomEmbeddingFunction("i_want_l2", 5); - try { - const collection = await client.createCollection({ + await expect( + client.createCollection({ name: "test_provided_over_schema", schema, embeddingFunction: providedEf, - }); - } catch (error) { - expect(error).toBeDefined(); - } + }), + ).rejects.toBeDefined(); }); test("it should use provided embedding function if no schema", async () => { const providedEf = new DefaultSpaceCustomEmbeddingFunction("i_want_l2", 5);