'use strict';vartest=require('tape');varutils=require('../lib/utils');test('merge()',function(t){t.deepEqual(utils.merge({a:'b'},{a:'c'}),{a:['b','c']},'merges two objects with the same key');varoneMerged=utils.merge({foo:'bar'},{foo:{first:'123'}});t.deepEqual(oneMerged,{foo:['bar',{first:'123'}]},'merges a standalone and an object into an array');vartwoMerged=utils.merge({foo:['bar',{first:'123'}]},{foo:{second:'456'}});t.deepEqual(twoMerged,{foo:{0:'bar',1:{first:'123'},second:'456'}},'merges a standalone and two objects into an array');varsandwiched=utils.merge({foo:['bar',{first:'123',second:'456'}]},{foo:'baz'});t.deepEqual(sandwiched,{foo:['bar',{first:'123',second:'456'},'baz']},'merges an object sandwiched by two standalones into an array');varnestedArrays=utils.merge({foo:['baz']},{foo:['bar','xyzzy']});t.deepEqual(nestedArrays,{foo:['baz','bar','xyzzy']});t.end();});test('assign()',function(t){vartarget={a:1,b:2};varsource={b:3,c:4};varresult=utils.assign(target,source);t.equal(result,target,'returns the target');t.deepEqual(target,{a:1,b:3,c:4},'target and source are merged');t.deepEqual(source,{b:3,c:4},'source is untouched');t.end();});