Add _.conforms test for missing object properties.

This commit is contained in:
John-David Dalton
2015-12-27 23:58:51 -06:00
parent 6da255f786
commit 28420ac1fc

View File

@@ -2760,6 +2760,19 @@
assert.deepEqual(actual, [objects[1], objects[2]]);
});
QUnit.test('should not invoke `source` predicates for missing `object` properties', function(assert) {
assert.expect(2);
var count = 0;
var conforms = _.conforms({
'a': function() { count++; return true; }
});
assert.strictEqual(conforms({}), false);
assert.strictEqual(count, 0);
});
QUnit.test('should work with a function for `object`', function(assert) {
assert.expect(2);