Fix cd into leafs

Issue: https://tree.taiga.io/project/jktjkt-netconf-cli/issue/173
Change-Id: I553c6d769204ebadc3625b9a3fc397adb64ca484
diff --git a/tests/cd.cpp b/tests/cd.cpp
index 174ffd0..3e29d5a 100644
--- a/tests/cd.cpp
+++ b/tests/cd.cpp
@@ -33,6 +33,7 @@
     schema->addRpc("/", "example:launch-nukes");
     schema->addList("/", "example:ports", {"name"});
     schema->addLeaf("/example:ports", "example:name", createEnum({"A", "B", "C"}));
+    schema->addLeaf("/", "example:myLeaf", yang::Int32{});
     Parser parser(schema);
     std::string input;
     std::ostringstream errorStream;
@@ -330,6 +331,11 @@
             input = "cd example:launch-nukes";
         }
 
+        SECTION("cd into a leaf")
+        {
+            input = "cd example:myLeaf";
+        }
+
         REQUIRE_THROWS_AS(parser.parseCommand(input, errorStream), InvalidCommandException);
     }
 }
diff --git a/tests/path_completion.cpp b/tests/path_completion.cpp
index 0585be0..4b6b25b 100644
--- a/tests/path_completion.cpp
+++ b/tests/path_completion.cpp
@@ -366,5 +366,12 @@
         expectedContextLength = 0;
     }
 
+    SECTION("leafs not completed for cd")
+    {
+        input = "cd ";
+        expectedCompletions = {"example:addresses", "example:ano/", "example:anoda/", "example:bota/","example:list", "example:ovoce", "example:ovocezelenina", "example:twoKeyList", "second:amelie/"};
+        expectedContextLength = 0;
+    }
+
     REQUIRE(parser.completeCommand(input, errorStream) == (Completions{expectedCompletions, expectedContextLength}));
 }