1 | "use strict";
|
2 |
|
3 | const assert = require('assert');
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | module.exports = function (instantiate)
|
9 | {
|
10 | describe(`${instantiate().constructor.name}`, function ()
|
11 | {
|
12 | let instance = null;
|
13 |
|
14 | beforeEach(function ()
|
15 | {
|
16 | instance = instantiate();
|
17 | });
|
18 |
|
19 | it(`can set and get`, function (done)
|
20 | {
|
21 | const id = Math.random()
|
22 | .toString();
|
23 |
|
24 | instance.set(id, {}, (err, sess) =>
|
25 | {
|
26 | instance.get(id, (err, sess) =>
|
27 | {
|
28 | delete sess.expires;
|
29 | delete sess.id;
|
30 | assert.equal(err, null);
|
31 | assert.deepEqual(sess, {});
|
32 | instance.destroy(id, done);
|
33 | });
|
34 | });
|
35 | })
|
36 | });
|
37 | }
|