Skip to content

Commit

Permalink
Use callbacks instead of return values
Browse files Browse the repository at this point in the history
  • Loading branch information
bergie committed Oct 2, 2012
1 parent ed039aa commit dab2276
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions storage/ff_redis.js
Expand Up @@ -6,7 +6,7 @@
/* public methods*/
return {
set: function (key, value, cb) {
return redis.set(key, value, function (err, data) {
redis.set(key, value, function (err, data) {
if (!cb) {
return;
}
Expand All @@ -23,7 +23,7 @@

},
del: function (key, cb) {
return redis.del(key, cb);
redis.del(key, cb);
}
};
};
Expand Down
16 changes: 8 additions & 8 deletions test/redis_test.js
Expand Up @@ -7,8 +7,8 @@ describe('Redis Storage', function() {
describe('Basic Stuff', function() {
var serialized_object = "{ 'foo' : 'bar', 'john' : 'doe' }";
it('should be able to take a JSON and save', function(done) {
var result = storage.set('id', serialized_object, function (err, data) {
result.should.equal(true);
storage.set('id', serialized_object, function (err, data) {
should.equal(err, null);
done();
});

Expand All @@ -24,13 +24,13 @@ describe('Redis Storage', function() {

it('should be able to delete', function(done) {
storage.set('foo', 'foo_value');
var result = storage.del('foo')
result.should.equal(true);
storage.get('foo', function(err, data) {
should.equal(data, null);
done();
storage.del('foo', function (err) {
should.equal(err, null);
storage.get('foo', function(err, data) {
should.equal(data, null);
done();
});
});

});

});
Expand Down

0 comments on commit dab2276

Please sign in to comment.