mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 18:37:50 +00:00
Add test for indirectly merging Object properties.
This commit is contained in:
24
test/test.js
24
test/test.js
@@ -7555,16 +7555,34 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should not merge `Object.prototype` properties', function(assert) {
|
QUnit.test('should not indirectly merge builtin prototype properties', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(2);
|
||||||
|
|
||||||
|
_.merge({}, { 'toString': { 'constructor': { 'prototype': { 'a': 1 } } } });
|
||||||
|
|
||||||
|
var actual = 'a' in funcProto;
|
||||||
|
delete funcProto.a;
|
||||||
|
|
||||||
|
assert.notOk(actual);
|
||||||
|
|
||||||
_.merge({}, { 'constructor': { 'prototype': { 'a': 1 } } });
|
_.merge({}, { 'constructor': { 'prototype': { 'a': 1 } } });
|
||||||
|
|
||||||
var actual = 'a' in objectProto;
|
actual = 'a' in objectProto;
|
||||||
delete objectProto.a;
|
delete objectProto.a;
|
||||||
|
|
||||||
assert.notOk(actual);
|
assert.notOk(actual);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QUnit.test('should not indirectly merge `Object` properties', function(assert) {
|
||||||
|
assert.expect(1);
|
||||||
|
|
||||||
|
_.merge({}, { 'constructor': { 'a': 1 } });
|
||||||
|
|
||||||
|
var actual = 'a' in Object;
|
||||||
|
delete Object.a;
|
||||||
|
|
||||||
|
assert.notOk(actual);
|
||||||
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|||||||
Reference in New Issue
Block a user