delete has many to many progress

This commit is contained in:
sascha 2026-05-27 16:10:26 +02:00
parent 98d58d8e60
commit 73bd6f641c
1 changed files with 6 additions and 17 deletions

View File

@ -22,23 +22,6 @@ void validate_author_state(const object_ptr<AuthorType>& ptr, object_state expec
} }
} }
namespace matador::utils {
template < typename ValueType >
std::ostream& operator<<(std::ostream& os, const result<ValueType, error>& value) {
if (value) {
return os;
}
return os << "Error: " << value.err();
}
std::ostream& operator<<(std::ostream& os, const result<void, error>& value) {
if (value) {
return os;
}
return os << "Error: " << value.err();
}
}
TEST_CASE_METHOD(SessionFixture, "Test delete object with has many to many relation", "[session][delete][has_many_to_many]") { TEST_CASE_METHOD(SessionFixture, "Test delete object with has many to many relation", "[session][delete][has_many_to_many]") {
auto result = schema.attach<recipe_sequence>("recipes") auto result = schema.attach<recipe_sequence>("recipes")
.and_then( [this] { return schema.attach<ingredient_sequence>("ingredients"); } ) .and_then( [this] { return schema.attach<ingredient_sequence>("ingredients"); } )
@ -77,4 +60,10 @@ TEST_CASE_METHOD(SessionFixture, "Test delete object with has many to many relat
const auto ing_result = ses.find<ingredient_sequence>(ingredients[0]->id); const auto ing_result = ses.find<ingredient_sequence>(ingredients[0]->id);
REQUIRE(ing_result.is_ok()); REQUIRE(ing_result.is_ok());
REQUIRE(ing_result.value()->recipes.size() == 2); REQUIRE(ing_result.value()->recipes.size() == 2);
auto del_res = ses.remove(recipes[0]);
REQUIRE(del_res);
recipe_result = ses.find<recipe_sequence>(1);
REQUIRE_FALSE(recipe_result);
} }