Skip to content

Commit

Permalink
Add test to check updated collection and fix double question mark in …
Browse files Browse the repository at this point in the history
…api url formatting
  • Loading branch information
BlackyDrum committed Nov 8, 2024
1 parent 8949e1c commit 43f89d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ChromaDB/Client/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ namespace chromadb {

try
{
m_ChromaApiClient.Put(std::format("/collections/{}?tenant={}?&database={}", oldCollection.GetId(), m_Tenant, m_Database), json);
m_ChromaApiClient.Put(std::format("/collections/{}?tenant={}&database={}", oldCollection.GetId(), m_Tenant, m_Database), json);
}
catch (ChromaException& e)
{
Expand Down
4 changes: 4 additions & 0 deletions tests/test_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,8 @@ TEST_F(ClientTest, CanUpdateCollection)
EXPECT_EQ(collection2.GetId(), collection.GetId());
EXPECT_EQ(collection2.GetEmbeddingFunction(), nullptr);

EXPECT_THROW(client->GetCollection("test_collection"), ChromaInvalidCollectionException);

std::vector<Collection> collections = client->GetCollections();
EXPECT_EQ(collections.size(), 1);
EXPECT_EQ(collections[0].GetName(), "test_collection_updated");
Expand Down Expand Up @@ -483,6 +485,8 @@ TEST_F(ClientTest, CanUpdateCollectionWithMetadata)
EXPECT_EQ(collection2.GetId(), collection.GetId());
EXPECT_EQ(collection2.GetEmbeddingFunction(), nullptr);

EXPECT_THROW(client->GetCollection("test_collection"), ChromaInvalidCollectionException);

std::vector<Collection> collections = client->GetCollections();
EXPECT_EQ(collections.size(), 1);
EXPECT_EQ(collections[0].GetName(), "test_collection_updated");
Expand Down

0 comments on commit 43f89d8

Please sign in to comment.