Comparing version 1.0.0 to 1.0.1
@@ -36,2 +36,6 @@ /* jshint node:true */ | ||
Cache.prototype.toString = function() { | ||
return JSON.stringify(this.storage); | ||
}; | ||
module.exports = Cache; |
{ | ||
"name": "nodesi", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "ESI: the good parts in node.js", | ||
@@ -5,0 +5,0 @@ "main": "esi.js", |
@@ -60,2 +60,27 @@ /* jshint node:true */ | ||
it('should be able to dump cache to string', function () { | ||
// given | ||
var cache = new Cache({ | ||
clock: { | ||
now: function() { | ||
return 0; | ||
} | ||
} | ||
}); | ||
// when | ||
cache.set('x', { | ||
value: 'y' | ||
}); | ||
assert.equal(cache.toString(), JSON.stringify({ | ||
x: { | ||
value: 'y', | ||
expirationTime: 0 | ||
} | ||
})); | ||
}); | ||
}); |
29973
789