mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 11:27:50 +00:00
Expand function test for _.matches.
This commit is contained in:
@@ -7481,12 +7481,14 @@
|
|||||||
|
|
||||||
test('should work with a function for `source`', 1, function() {
|
test('should work with a function for `source`', 1, function() {
|
||||||
function source() {}
|
function source() {}
|
||||||
|
|
||||||
source.a = 1;
|
source.a = 1;
|
||||||
source.b = 2;
|
source.b = function() {};
|
||||||
|
source.c = 3;
|
||||||
|
|
||||||
var expected = [false, true],
|
var expected = [false, true],
|
||||||
matches = _.matches(source),
|
matches = _.matches(source),
|
||||||
objects = [{ 'a': 1 }, { 'a': 1, 'b': 2 }],
|
objects = [{ 'a': 1 }, { 'a': 1, 'b': source.b, 'c': 3 }],
|
||||||
actual = _.map(objects, matches);
|
actual = _.map(objects, matches);
|
||||||
|
|
||||||
deepEqual(actual, expected);
|
deepEqual(actual, expected);
|
||||||
|
|||||||
Reference in New Issue
Block a user