File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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 /**
@@ -167,4 +167,28 @@ describe('Sync service provider', function () {
167167 // 2 clients sync fast first and then every 5 seconds -> 2*12 = 24. Actual 32.
168168 cy . get ( '@sync.all' ) . its ( 'length' ) . should ( 'be.lessThan' , 60 )
169169 } )
170+
171+ it ( 'syncs even when initial state was present' , function ( ) {
172+ const sourceMap = this . source . getMap ( )
173+ const targetMap = this . target . getMap ( )
174+ sourceMap . set ( 'unrelated' , 'value' )
175+ cy . intercept ( { method : 'POST' , url : '**/apps/text/session/*/push' } ) . as (
176+ 'push' ,
177+ )
178+ cy . intercept ( { method : 'POST' , url : '**/apps/text/session/*/sync' } ) . as (
179+ 'sync' ,
180+ )
181+ cy . wait ( '@push' )
182+ cy . then ( ( ) => {
183+ sourceMap . set ( 'keyA' , 'valueA' )
184+ expect ( targetMap . get ( 'keyB' ) ) . to . be . eq ( undefined )
185+ } )
186+ cy . wait ( '@sync' )
187+ cy . wait ( '@sync' )
188+ // eslint-disable-next-line cypress/no-unnecessary-waiting
189+ cy . wait ( 1000 )
190+ cy . then ( ( ) => {
191+ expect ( targetMap . get ( 'keyA' ) ) . to . be . eq ( 'valueA' )
192+ } )
193+ } )
170194} )
You can’t perform that action at this time.
0 commit comments