@@ -69,10 +69,10 @@ test('applyPatch', function (t) {
6969 t . deepEqual ( outputs [ 0 ] . unpatch , { prop : false } )
7070 t . true ( Array . isArray ( outputs [ 0 ] . mutations ) )
7171
72- const { unpatch , mutations } = outputs
73- t . deepEqual ( unpatch , { prop : false } )
74- t . true ( Array . isArray ( mutations ) )
75- t . deepEqual ( mutations , outputs [ 0 ] . mutations )
72+ t . deepEqual ( outputs . patch , patch )
73+ t . deepEqual ( outputs . unpatch , { prop : false } )
74+ t . deepEqual ( outputs . mutations , outputs [ 0 ] . mutations )
75+ t . true ( Array . isArray ( outputs . mutations ) )
7676} )
7777
7878test ( 'applyPatch with function' , function ( t ) {
@@ -145,3 +145,19 @@ test('filtered patches by createPatchAndUnpatchFromMutations must be the same as
145145 t . deepEqual ( output [ 0 ] . patch , { } )
146146 t . deepEqual ( output [ 1 ] . patch , patch )
147147} )
148+
149+ test ( 'Matching subscriber patch and original patch' , function ( t ) {
150+ const store = createStore ( {
151+ [ 'one' ] : { } ,
152+ } )
153+ store . subscribe ( ( patch ) => {
154+ t . deepEqual ( patch , { one : { two : TYPE . Replace ( { three : true } ) } } )
155+ } )
156+
157+ const listeners = store . applyPatch ( ( d ) => {
158+ d [ 'one' ] [ 'two' ] = { three : true }
159+ } )
160+
161+ t . deepEqual ( listeners [ 0 ] . patch , listeners . patch )
162+ t . deepEqual ( store . state , { one : { two : { three : true } } } )
163+ } )
0 commit comments