-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
31 lines (26 loc) · 884 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var assert = require('assert');
var connect = require('connect');
var MedeaStore = require('./')(connect);
var store = new MedeaStore();
store.on('connect', function(){
// #set()
store.set('123', { cookie: { maxAge: 2000 }, name: 'tj' }, function(err){
assert.ok(!err, '#set() got an error');
// #get()
store.get('123', function(err, data){
assert.ok(!err, '#get() got an error');
assert.deepEqual({ cookie: { maxAge: 2000 }, name: 'tj' }, data);
// #set null
store.set('123', { cookie: { maxAge: 2000 }, name: 'tj' }, function(){
store.destroy('123', function(){
console.log('done');
store.client.close();
});
});
throw new Error('Error in fn');
});
});
});
process.once('uncaughtException', function (err) {
assert.ok(err.message === 'Error in fn', '#get() catch wrong error');
});