From 48d6b4b829f3e3edf7edbff67e64cd86eb6d9096 Mon Sep 17 00:00:00 2001 From: Bryan Donovan Date: Mon, 7 Jul 2014 10:08:44 -0700 Subject: [PATCH] unit test for setex() --- test/caching.unit.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/caching.unit.js b/test/caching.unit.js index 5f1f5dc..54b0df4 100644 --- a/test/caching.unit.js +++ b/test/caching.unit.js @@ -147,6 +147,28 @@ describe("caching", function () { }); }); + describe("setex()", function () { + var fake_store; + + beforeEach(function () { + fake_store = { + get: function () {}, + set: function () {}, + del: function () {}, + setex: function () {} + }; + + sinon.stub(fake_store, 'setex'); + + cache = caching({store: fake_store}); + }); + + it("passes the params to the underlying store's setex() method", function () { + cache.setex('foo', 'bar', 'blah'); + assert.ok(fake_store.setex.calledWith('foo', 'bar', 'blah')); + }); + }); + describe("keys()", function () { var key_count; var saved_keys = [];