-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixed expires should be stored as number
- Fixed bug in cluster mode - Update unit test now using assert strict
- Loading branch information
Showing
4 changed files
with
72 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
var assert = require('assert'); | ||
var Path = require('path'); | ||
var Cache = require('../'); | ||
|
||
describe('cacheman-file-multi', function() { | ||
var cache1, | ||
cache2; | ||
|
||
before(function(done) { | ||
cache1 = new Cache({ | ||
tmpDir: Path.join(process.cwd(), 'temp') | ||
}, {}); | ||
cache2 = new Cache({ | ||
tmpDir: Path.join(process.cwd(), 'temp') | ||
}, {}); | ||
done(); | ||
}); | ||
after(function(done) { | ||
cache1.clear('test'); | ||
cache2.clear('test'); | ||
done(); | ||
}); | ||
|
||
it('should store items', function(done) { | ||
cache1.set('test1', { | ||
a: 1 | ||
}, function(err) { | ||
if (err) | ||
return done(err); | ||
cache1.get('test1', function(err, data) { | ||
if (err) | ||
return done(err); | ||
assert.strictEqual(data.a, 1); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
it('should get stored items', function(done) { | ||
cache1.get('test1', function(err, data) { | ||
if (err) | ||
return done(err); | ||
assert.strictEqual(data.a, 1); | ||
cache2.get('test1', function(err, data) { | ||
if (err) | ||
return done(err); | ||
try { | ||
assert.notStrictEqual(data, null) | ||
assert.strictEqual(data.a, 1) | ||
done() | ||
} catch (e) { | ||
done(e) | ||
} | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters