fixed insert_step_processor

This commit is contained in:
2026-05-21 12:04:10 +02:00
parent 7216f07c9f
commit 72019bc1e7
4 changed files with 64 additions and 43 deletions
+2 -1
View File
@@ -25,7 +25,8 @@ TEST_CASE_METHOD(SessionFixture, "Test insert object with belongs to relation wi
const auto carrie = make_object<book_identity>("Carrie", s_king, 1974);
REQUIRE(carrie.is_transient());
REQUIRE(ses.insert(carrie).is_ok());
const auto res = ses.insert(carrie);
REQUIRE(res.is_ok());
REQUIRE(carrie.is_persistent());
auto found_author = ses.find<author_identity>(s_king->id);
+11 -1
View File
@@ -61,6 +61,16 @@ 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();
}
}
TEST_CASE_METHOD(SessionFixture, "Test insert object with has many relation", "[session][insert][has_many]") {
const auto result = schema.attach<book>("books")
.and_then( [this] { return schema.attach<author>("authors"); } )
@@ -79,7 +89,7 @@ TEST_CASE_METHOD(SessionFixture, "Test insert object with has many relation", "[
validate_author_state(s_king, object_state::Transient);
auto res = ses.insert(s_king);
REQUIRE(res.is_ok());
REQUIRE(res);
validate_author_state(s_king, object_state::Persistent);
}