SysrepoAccess: Fix overwriting leafs without commit

Bug: https://tree.taiga.io/project/jktjkt-netconf-cli/issue/229
Change-Id: Ia63b2ba5b91020108d8d1c64aa5db7cafa969f69
diff --git a/tests/datastore_access.cpp b/tests/datastore_access.cpp
index 76e4f7f..bbcae25 100644
--- a/tests/datastore_access.cpp
+++ b/tests/datastore_access.cpp
@@ -222,6 +222,17 @@
         REQUIRE(datastore.getItems("/example-schema:leafString") == expected);
     }
 
+    SECTION("set a string, then set it to something else without commiting")
+    {
+        REQUIRE_CALL(mockRunning, write("/example-schema:leafString", std::nullopt, "oops"s));
+        datastore.setLeaf("/example-schema:leafString", "blah"s);
+        datastore.setLeaf("/example-schema:leafString", "oops"s);
+        datastore.commitChanges();
+        DatastoreAccess::Tree expected{{"/example-schema:leafString", "oops"s}};
+        REQUIRE(datastore.getItems("/example-schema:leafString") == expected);
+
+    }
+
     SECTION("set a non-existing leaf")
     {
         catching<OnInvalidSchemaPathCreate>([&] {