File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -35,3 +35,10 @@ test('isRemoteFunction', async t => {
3535 t . false ( isRemoteFunction ( ( ) => { } ) )
3636 t . false ( isRemoteFunction ( 'other' ) )
3737} )
38+
39+ test ( 'Types must be same instance when creating new dop' , function ( t ) {
40+ const dopcopy = dop . factory ( )
41+ t . is ( dop . TYPE . Inner , dopcopy . TYPE . Inner )
42+ t . is ( dop . TYPE . Replace , dopcopy . TYPE . Replace )
43+ t . is ( dop . TYPE . Splice , dopcopy . TYPE . Splice )
44+ } )
Original file line number Diff line number Diff line change 11import test from 'ava'
2- import { merge } from '../'
2+ import dop from '../'
33import _ from 'lodash' // https://github.com/lodash/lodash/blob/master/test/merge.test.js
44import R from 'ramda'
55
66// https://jsperf.com/merge-challenge
77
8- run ( merge , 'dop' )
8+ run ( dop . merge , 'dop' )
99run ( _ . merge , 'lodash' )
1010
1111function run ( merge , name ) {
@@ -32,6 +32,16 @@ function run(merge, name) {
3232 t . deepEqual ( merge ( names , ages , heights ) , expected )
3333 } )
3434
35+ test ( name + ': must be a completly new references' , function ( t ) {
36+ var object = { obj : { a : 1 } , arr : [ 2 ] }
37+ var actual = merge ( { } , object )
38+
39+ t . deepEqual ( actual , object )
40+ t . not ( object , actual )
41+ t . not ( object . obj , actual . obj )
42+ t . not ( object . arr , actual . arr )
43+ } )
44+
3545 test ( name + ': should work with four arguments' , function ( t ) {
3646 var expected = { a : 4 } ,
3747 actual = merge ( { a : 1 } , { a : 2 } , { a : 3 } , expected )
You can’t perform that action at this time.
0 commit comments