File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -34,8 +34,8 @@ describe('Sync service provider', function () {
3434 } )
3535
3636 afterEach ( function ( ) {
37- this . sourceProvider ?. destroy ( )
38- this . targetProvider ?. destroy ( )
37+ cy . get ( '@ sourceProvider' ) . invoke ( 'destroy' )
38+ cy . get ( '@ targetProvider' ) . invoke ( 'destroy' )
3939 } )
4040
4141 /**
@@ -162,4 +162,27 @@ describe('Sync service provider', function () {
162162 // 2 clients sync fast first and then every 5 seconds -> 2*12 = 24. Actual 32.
163163 cy . get ( '@sync.all' ) . its ( 'length' ) . should ( 'be.lessThan' , 60 )
164164 } )
165+
166+ it ( 'syncs even when initial state was present' , function ( ) {
167+ const sourceMap = this . source . getMap ( )
168+ const targetMap = this . target . getMap ( )
169+ sourceMap . set ( 'unrelated' , 'value' )
170+ cy . intercept ( { method : 'POST' , url : '**/apps/text/session/*/push' } )
171+ . as ( 'push' )
172+ cy . intercept ( { method : 'POST' , url : '**/apps/text/session/*/sync' } )
173+ . as ( 'sync' )
174+ cy . wait ( '@push' )
175+ cy . then ( ( ) => {
176+ sourceMap . set ( 'keyA' , 'valueA' )
177+ expect ( targetMap . get ( 'keyB' ) ) . to . be . eq ( undefined )
178+ } )
179+ cy . wait ( '@sync' )
180+ cy . wait ( '@sync' )
181+ // eslint-disable-next-line cypress/no-unnecessary-waiting
182+ cy . wait ( 1000 )
183+ cy . then ( ( ) => {
184+ expect ( targetMap . get ( 'keyA' ) ) . to . be . eq ( 'valueA' )
185+ } )
186+ } )
187+
165188} )
You can’t perform that action at this time.
0 commit comments