0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/mjsunit/test-process-mixin.js
Felix Geisendörfer f080de5380 Two bug fixes for process.mixin
Bug #1 occurred when trying to use process.mixin on a function and
produced a fatal exception.

Bug #2 occurred when trying to do a deep merge with an object containing
one or more objects with a nodeType property. In those cases the deep
copy for this part of the object was not performed and a shallow one was
performed instead.

Both of these bugs were artifacts of the jQuery.extend port.
2009-12-06 19:21:06 +01:00

16 lines
436 B
JavaScript

process.mixin(require("./common"));
var target = function() {};
process.mixin(target, {
foo: 'bar'
});
assert.equal('bar', target.foo);
// This test verifies there are no DOM-related aspects to process.mixin which
// originally had been in there due to its jQuery origin.
var fakeDomElement = {deep: {nodeType: 4}};
target = {};
process.mixin(true, target, fakeDomElement);
assert.notStrictEqual(target.deep, fakeDomElement.deep);