mirror of
https://github.com/cnodejs/nodeclub.git
synced 2025-12-08 19:55:55 +00:00
25 lines
633 B
JavaScript
25 lines
633 B
JavaScript
var cache = require('../../common/cache');
|
|
var should = require('should');
|
|
|
|
describe('test/common/cache.test.js', function () {
|
|
it('should set && get', function (done) {
|
|
cache.set('alsotang', {age: 23}, function () {
|
|
cache.get('alsotang', function (err, data) {
|
|
data.should.eql({age: 23});
|
|
done();
|
|
});
|
|
});
|
|
});
|
|
|
|
it('should expire', function (done) {
|
|
cache.set('alsotang', {age: 23}, 1, function () {
|
|
setTimeout(function () {
|
|
cache.get('alsotang', function (err, data) {
|
|
should.not.exist(data);
|
|
done();
|
|
});
|
|
}, 1.5 * 1000);
|
|
});
|
|
});
|
|
});
|