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 2626
2727var assert = require ( 'perjury' ) . assert ,
2828 noopLog = require ( './log' ) ,
29+ memoryPersistence = require ( './persistence' ) . memoryPersistence ,
2930 _ = require ( 'lodash' ) ;
3031
3132function configureAppSetup ( config ) {
3233 return {
3334 topic : function ( ) {
3435 var app = require ( '../../lib/app' ) . makeApp ( _ . defaults ( config , {
3536 domains : [ ]
36- } ) , noopLog , require ( '../../lib/persistence' ) ( '/tmp' ) ) ,
37+ } ) , noopLog , memoryPersistence ( ) ) ,
3738 cb = this . callback ;
3839
3940 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) {
5555 return _ . assign ( { } , buildMockSetup ( configurePath ) , obj ) ;
5656}
5757
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+
5875module . exports . wrapFsMocks = wrapFsMocks ;
76+ module . exports . memoryPersistence = makeInMemoryPersistence ;
You can’t perform that action at this time.
0 commit comments