How does jquery replace the test node into a label?

  node.js, question

The code is as follows, how to add an A tag to Guest-Guest in the following code? At present, I only know how to get this value. I want to wrap all the html that are not wrapped into tags, so that it can be convenient for subsequent operations.

<li id="test" value="0">
 Guest - Guest
 <ul class="task-list">
 <li>Role = $everyone, $unauthenticated</li>
 <li>
 Has access to the "List projects" function, but none of the others
 </li>
 </ul>
 </li>
Vartest = $ ("# test"). contents (). filter (function () {//value)
 return this.nodeType === 3;
 })[0].nodeValue;
Vartest = $ ("# test"). contents (). each (function (index, node) {//takes value
 if(this.nodeType === 3){
 $(this).wrap("<a class=\"wrap\"> </a>");
 };
 });

demo