@@ -300,27 +300,30 @@ describe('instrument', () => {
300300 let configuredLiftedStore ;
301301
302302 beforeEach ( ( ) => {
303- configuredStore = createStore ( counter , instrument ( undefined , { maxAge : 2 } ) ) ;
303+ configuredStore = createStore ( counter , instrument ( undefined , { maxAge : 3 } ) ) ;
304304 configuredLiftedStore = configuredStore . liftedStore ;
305305 } ) ;
306306
307- it ( 'should remove earliest action when maxAge is reached' , ( ) => {
307+ it ( 'should auto-commit earliest non-@@INIT action when maxAge is reached' , ( ) => {
308+ configuredStore . dispatch ( { type : 'INCREMENT' } ) ;
308309 configuredStore . dispatch ( { type : 'INCREMENT' } ) ;
309310 let liftedStoreState = configuredLiftedStore . getState ( ) ;
310311
311- expect ( configuredStore . getState ( ) ) . toBe ( 1 ) ;
312- expect ( Object . keys ( liftedStoreState . actionsById ) . length ) . toBe ( 2 ) ;
312+ expect ( configuredStore . getState ( ) ) . toBe ( 2 ) ;
313+ expect ( Object . keys ( liftedStoreState . actionsById ) . length ) . toBe ( 3 ) ;
313314 expect ( liftedStoreState . committedState ) . toBe ( undefined ) ;
315+ expect ( liftedStoreState . stagedActionIds ) . toInclude ( 1 ) ;
314316
317+ // Triggers auto-commit.
315318 configuredStore . dispatch ( { type : 'INCREMENT' } ) ;
316319 liftedStoreState = configuredLiftedStore . getState ( ) ;
317320
318- expect ( configuredStore . getState ( ) ) . toBe ( 2 ) ;
319- expect ( Object . keys ( liftedStoreState . actionsById ) . length ) . toBe ( 2 ) ;
320- expect ( liftedStoreState . stagedActionIds ) . toExclude ( 0 ) ;
321+ expect ( configuredStore . getState ( ) ) . toBe ( 3 ) ;
322+ expect ( Object . keys ( liftedStoreState . actionsById ) . length ) . toBe ( 3 ) ;
323+ expect ( liftedStoreState . stagedActionIds ) . toExclude ( 1 ) ;
321324 expect ( liftedStoreState . computedStates [ 0 ] . state ) . toBe ( 1 ) ;
322325 expect ( liftedStoreState . committedState ) . toBe ( 1 ) ;
323- expect ( liftedStoreState . currentStateIndex ) . toBe ( 1 ) ;
326+ expect ( liftedStoreState . currentStateIndex ) . toBe ( 2 ) ;
324327 } ) ;
325328
326329 it ( 'should handle skipped actions' , ( ) => {
0 commit comments