Add non-function constructor tests for _.isMap, _.isSet, and _.isWeakMap.

This commit is contained in:
John-David Dalton
2016-03-10 16:33:29 -08:00
parent 51a3c5d4e8
commit c7319d004d

View File

@@ -9972,6 +9972,19 @@
assert.strictEqual(_.isMap(weakMap), false);
});
QUnit.test('should work for objects with a non-function `constructor` (test in IE 11)', function(assert) {
assert.expect(1);
var values = [true, false],
expected = lodashStable.map(values, alwaysFalse);
var actual = lodashStable.map(values, function(value) {
return _.isMap({ 'constructor': value });
});
assert.deepEqual(actual, expected);
});
QUnit.test('should work with maps from another realm', function(assert) {
assert.expect(1);
@@ -11092,6 +11105,19 @@
assert.strictEqual(_.isSet(weakSet), false);
});
QUnit.test('should work for objects with a non-function `constructor` (test in IE 11)', function(assert) {
assert.expect(1);
var values = [true, false],
expected = lodashStable.map(values, alwaysFalse);
var actual = lodashStable.map(values, function(value) {
return _.isSet({ 'constructor': value });
});
assert.deepEqual(actual, expected);
});
QUnit.test('should work with weak sets from another realm', function(assert) {
assert.expect(1);
@@ -11384,6 +11410,19 @@
assert.strictEqual(_.isWeakMap(symbol), false);
});
QUnit.test('should work for objects with a non-function `constructor` (test in IE 11)', function(assert) {
assert.expect(1);
var values = [true, false],
expected = lodashStable.map(values, alwaysFalse);
var actual = lodashStable.map(values, function(value) {
return _.isWeakMap({ 'constructor': value });
});
assert.deepEqual(actual, expected);
});
QUnit.test('should work with weak maps from another realm', function(assert) {
assert.expect(1);