@@ -949,6 +949,56 @@ describe("Sync", function() {
949949 } , 20 ) ;
950950 } ) ;
951951 } ) ;
952+
953+ describe ( "when node was also deleted on remote" , function ( ) {
954+ beforeEach ( function ( ) {
955+ this . emitChange = sinon . spy ( this . rs . local , "emitChange" ) ;
956+
957+ this . rs . sync . autoMergeDocument ( {
958+ path : "foo" ,
959+ common : { body : "foo" , contentType : "bloo" , revision : "common" } ,
960+ local : { body : false } ,
961+ remote : { body : false }
962+ } ) ;
963+ } ) ;
964+
965+ it ( "does not emit a conflict event" , function ( done ) {
966+ setTimeout ( ( ) => {
967+ expect ( this . emitChange . called ) . to . be . false ;
968+ done ( ) ;
969+ } , 20 ) ;
970+ } ) ;
971+ } ) ;
972+
973+ describe ( "when node was changed on remote, but deleted locally" , function ( ) {
974+ beforeEach ( function ( ) {
975+ this . emitChange = sinon . spy ( this . rs . local , "emitChange" ) ;
976+
977+ this . rs . sync . autoMergeDocument ( {
978+ path : "foo" ,
979+ remote : { body : "bar" , contentType : "text/plain" , revision : "newrev" } ,
980+ common : { body : "foo" , contentType : "text/plain" , revision : "common" } ,
981+ local : { body : false }
982+ } ) ;
983+ } ) ;
984+
985+ it ( "emits a conflict event" , function ( done ) {
986+ setTimeout ( ( ) => {
987+ expect ( this . emitChange . called ) . to . be . true ;
988+ expect ( this . emitChange . getCall ( 0 ) . firstArg ) . to . deep . equal ( {
989+ origin : "conflict" ,
990+ path : "foo" ,
991+ oldValue : false ,
992+ newValue : "bar" ,
993+ lastCommonValue : "foo" ,
994+ oldContentType : undefined ,
995+ newContentType : "text/plain" ,
996+ lastCommonContentType : "text/plain"
997+ } ) ;
998+ done ( ) ;
999+ } , 20 ) ;
1000+ } ) ;
1001+ } ) ;
9521002 } ) ;
9531003
9541004 describe ( "#autoMergeFolder" , function ( ) {
0 commit comments