diff --git a/test/test_entity.cpp b/test/test_entity.cpp index e1d927134018063dd6e3992629973e28a229990a..ec117968e3a8d72304eacd27663889cf1cd156f0 100644 --- a/test/test_entity.cpp +++ b/test/test_entity.cpp @@ -201,6 +201,38 @@ TEST(test_entity, test_insert_with_parent) { EXPECT_EQ(inserted_parent.GetName(), parent.GetName()); } +// TODO(fspreck) cognitive complexity > 25 (threshold) +TEST(test_entity, test_insert_with_property) { // NOLINT + auto transaction = caosdb::transaction::Transaction( + std::shared_ptr<transaction::EntityTransactionService::Stub>(nullptr)); + + auto entity = Entity(); + entity.SetId("entity_id"); + + auto prop = Property(); + prop.SetName("prop_name"); + prop.SetId("prop_id"); + prop.SetImportance("prop_importance"); + prop.SetValue("prop_value"); + prop.SetUnit("prop_unit"); + prop.SetDatatype("prop_dtype"); + + entity.AppendProperty(prop); + + transaction.InsertEntity(&entity); + + EXPECT_EQ(entity.GetProperties().Size(), 1); + + auto inserted_prop = entity.GetProperties().At(0); + + EXPECT_EQ(prop.GetName(), inserted_prop.GetName()); + EXPECT_EQ(prop.GetId(), inserted_prop.GetId()); + EXPECT_EQ(prop.GetImportance(), inserted_prop.GetImportance()); + EXPECT_EQ(prop.GetValue(), inserted_prop.GetValue()); + EXPECT_EQ(prop.GetUnit(), inserted_prop.GetUnit()); + EXPECT_EQ(prop.GetDatatype(), inserted_prop.GetDatatype()); +} + // TODO(tf) cognitive complexity > 25 (threshold) TEST(test_entity, test_from_id_response) { // NOLINT IdResponse idResponse;