Add _.create and _.includes tests.

This commit is contained in:
John-David Dalton
2014-12-01 21:53:24 -08:00
parent 0bc1761dae
commit 4528311d77

View File

@@ -2159,6 +2159,16 @@
deepEqual(Circle.prototype, expected);
});
test('should assign own properties', 1, function() {
function Foo() {
this.a = 1;
this.c = 3;
}
Foo.prototype.b = 2;
deepEqual(_.create({}, new Foo), { 'a': 1, 'c': 3 });
});
test('should accept a falsey `prototype` argument', 1, function() {
var expected = _.map(falsey, _.constant({}));
@@ -5025,6 +5035,18 @@
});
});
test('should return `false` for empty collections', 1, function() {
var expected = _.map(empties, _.constant(false));
var actual = _.map(empties, function(value) {
try {
return _.includes(value);
} catch(e) {}
});
deepEqual(actual, expected);
});
test('should not be possible to perform a binary search', 1, function() {
strictEqual(_.includes([3, 2, 1], 3, true), true);
});