@@ -824,13 +824,19 @@ describe.only('Repository write', function() {
824824 vm3 . set ( 'tags' , [ 'a' , 'b' , 'c' ] ) ;
825825 vm3 . set ( 'name' , 'opqrstuvwxyz' ) ;
826826 vm3 . set ( 'bulk' , true ) ;
827+
828+ // upsert
829+ var vm4 = new ViewModel ( { id : '941931_upsert_bulk' , bulk : true } , dummyRepo ) ;
830+ vm4 . actionOnCommit = 'update' ; // simulate create -> update -> update replay scenario
831+
827832
828- dummyRepo . bulkCommit ( [ vm1 , vm2 , vm3 ] , function ( err , vms ) {
833+ dummyRepo . bulkCommit ( [ vm1 , vm2 , vm3 , vm4 ] , function ( err , vms ) {
829834 expect ( err ) . not . to . be . ok ( ) ;
830835 expect ( vms [ 0 ] . actionOnCommit ) . to . eql ( 'update' ) ;
831836 expect ( vms [ 1 ] . actionOnCommit ) . to . eql ( 'update' ) ;
832837 expect ( vms [ 2 ] . actionOnCommit ) . to . eql ( 'update' ) ;
833- expect ( vms ) . to . have . length ( 3 ) ;
838+ expect ( vms [ 3 ] . actionOnCommit ) . to . eql ( 'update' ) ;
839+ expect ( vms ) . to . have . length ( 4 ) ;
834840
835841 var query = { bulk : true } ;
836842 if ( type === 'elasticsearch6' )
@@ -844,7 +850,7 @@ describe.only('Repository write', function() {
844850
845851 dummyRepo . find ( query , function ( err , vms ) {
846852 expect ( err ) . not . to . be . ok ( ) ;
847- expect ( vms ) . to . have . length ( 3 ) ;
853+ expect ( vms ) . to . have . length ( 4 ) ;
848854
849855 done ( ) ;
850856 } ) ;
0 commit comments