From ddede735f7aeae4d52d0daa5c4a96b1564fab444 Mon Sep 17 00:00:00 2001 From: Bryan Donovan Date: Sun, 7 Apr 2013 13:47:49 -0700 Subject: [PATCH] test that we do not need callbacks for set() and del() in multi_caching --- test/multi_caching.unit.js | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/test/multi_caching.unit.js b/test/multi_caching.unit.js index 717c40e..808209c 100644 --- a/test/multi_caching.unit.js +++ b/test/multi_caching.unit.js @@ -61,6 +61,29 @@ describe("multi_caching", function () { }); }); }); + + it("lets us set data without a callback", function (done) { + multi_cache.set(key, value); + setTimeout(function () { + multi_cache.get(key, function (err, result) { + assert.equal(result, value); + memory_cache.get(key, function (err, result) { + assert.equal(result, value); + + redis_cache.get(key, function (err, result) { + check_err(err); + assert.equal(result, value); + + memory_cache2.get(key, function (err, result) { + check_err(err); + assert.equal(result, value); + done(); + }); + }); + }); + }); + }, 20); + }); }); describe("get()", function () { @@ -102,6 +125,31 @@ describe("multi_caching", function () { }); }); }); + + it("lets us delete data without a callback", function (done) { + multi_cache.set(key, value, function (err) { + check_err(err); + + multi_cache.del(key); + + setTimeout(function () { + memory_cache.get(key, function (err, result) { + assert.ok(!result); + + redis_cache.get(key, function (err, result) { + check_err(err); + assert.ok(!result); + + memory_cache2.get(key, function (err, result) { + check_err(err); + assert.ok(!result); + done(); + }); + }); + }); + }); + }, 10); + }); }); });