function beforeAfterHelper (method, callback) { var count = 0; var data = { 'key': 'val', 'key2': 'val' }; var jada = new Jada(data); jada[method](function (key, oldValue, newValue) { count++; callback(jada.get(key), oldValue, newValue); }); jada.set('key', 'newValue'); jada.set('key2', 'newValue'); (count).should.equal(2); }
it('should set the value', function () { var data = {'key': 'value'}; var jada = new Jada(data); jada.set('key', 'newValue'); jada.get('key').should.equal('newValue'); });
function beforeAfterKeyHelper (method, callback) { var data = {'key': 'value'}; var jada = new Jada(data); var count = 0; jada[method]('key', function (key, oldValue, newValue) { var currentValue = jada.get('key'); callback(currentValue, oldValue, newValue); count++; }); jada.set('key', 'hello'); (count).should.equal(1); }