Ad
  • Custom User Avatar

    suggested test cases:

    describe("set value", function(){
      let stuff = {};
      it ("set value", function(){
          namespace(stuff, 'moreStuff.name', 'the stuff');
          Test.assertSimilar(stuff, {moreStuff: {name: 'the stuff'}});
      });
    });
    
    describe("get value", function(){
      let stuff = {moreStuff: {name: 'the stuff'}};
      it ("valid path", function(){
          Test.assertEquals(namespace(stuff, 'moreStuff.name'), 'the stuff');
      });
      
      it ("invalid path", function(){
          Test.assertEquals(namespace(stuff, 'otherStuff.id'), undefined);
      });
    });