File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 26
26
27
27
var assert = require ( 'perjury' ) . assert ,
28
28
noopLog = require ( './log' ) ,
29
+ memoryPersistence = require ( './persistence' ) . memoryPersistence ,
29
30
_ = require ( 'lodash' ) ;
30
31
31
32
function configureAppSetup ( config ) {
32
33
return {
33
34
topic : function ( ) {
34
35
var app = require ( '../../lib/app' ) . makeApp ( _ . defaults ( config , {
35
36
domains : [ ]
36
- } ) , noopLog , require ( '../../lib/persistence' ) ( '/tmp' ) ) ,
37
+ } ) , noopLog , memoryPersistence ( ) ) ,
37
38
cb = this . callback ;
38
39
39
40
var server = app . listen ( config . port || 5320 , config . address || 'localhost' , function ( err ) {
Original file line number Diff line number Diff line change @@ -55,4 +55,22 @@ function wrapFsMocks(configurePath, obj) {
55
55
return _ . assign ( { } , buildMockSetup ( configurePath ) , obj ) ;
56
56
}
57
57
58
+ function makeInMemoryPersistence ( ) {
59
+ var store = new Map ( ) ;
60
+
61
+ return function ( ) {
62
+ return {
63
+ get : function ( namespace , key , cb ) {
64
+ process . nextTick ( cb . bind ( undefined , undefined , store . get ( namespace + key ) || { } ) ) ;
65
+ } ,
66
+ set : function ( namespace , key , data , cb ) {
67
+ store . set ( namespace + key , data ) ;
68
+ process . nextTick ( cb ) ;
69
+
70
+ }
71
+ } ;
72
+ } ;
73
+ }
74
+
58
75
module . exports . wrapFsMocks = wrapFsMocks ;
76
+ module . exports . memoryPersistence = makeInMemoryPersistence ;
You can’t perform that action at this time.
0 commit comments