mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-15 05:07:49 +00:00
Add _.create and _.includes tests.
This commit is contained in:
22
test/test.js
22
test/test.js
@@ -2159,6 +2159,16 @@
|
|||||||
deepEqual(Circle.prototype, expected);
|
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() {
|
test('should accept a falsey `prototype` argument', 1, function() {
|
||||||
var expected = _.map(falsey, _.constant({}));
|
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() {
|
test('should not be possible to perform a binary search', 1, function() {
|
||||||
strictEqual(_.includes([3, 2, 1], 3, true), true);
|
strictEqual(_.includes([3, 2, 1], 3, true), true);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user