File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
src/core/cache/decorators/helpers/add-emitter Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ describe('core/cache/decorators/helpers/add-emitter', () => {
19
19
this . remove = ( ) => null ;
20
20
this . set = ( ) => null ;
21
21
this . clear = ( ) => null ;
22
+ this . clone = ( ) => null ;
22
23
}
23
24
24
25
const
@@ -147,4 +148,24 @@ describe('core/cache/decorators/helpers/add-emitter', () => {
147
148
expect ( memory [ 1 ] ) . toEqual ( undefined ) ;
148
149
} ) ;
149
150
} ) ;
151
+
152
+ describe ( 'clone' , ( ) => {
153
+ it ( 'clones a cache' , ( ) => {
154
+ const
155
+ cache = new SimpleCache ( ) ,
156
+ { clone} = addEmitter ( cache ) ;
157
+
158
+ const memory = [ ] ;
159
+
160
+ cache [ eventEmitter ] . on ( 'clone' , ( ...args ) => {
161
+ memory . push ( args ) ;
162
+ } ) ;
163
+
164
+ cache . clone ( ) ;
165
+ expect ( memory [ 0 ] ) . toEqual ( [ cache , { result : new SimpleCache ( ) } ] ) ;
166
+
167
+ clone ( ) ;
168
+ expect ( memory [ 1 ] ) . toEqual ( undefined ) ;
169
+ } ) ;
170
+ } ) ;
150
171
} ) ;
You can’t perform that action at this time.
0 commit comments