mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 16:47:49 +00:00
Add tests for missing path parts for _.property and _.propertyOf.
This commit is contained in:
18
test/test.js
18
test/test.js
@@ -11748,6 +11748,16 @@
|
||||
|
||||
deepEqual(actual, expected);
|
||||
});
|
||||
|
||||
test('should return `undefined` if parts of `path` are missing', 2, function() {
|
||||
var object = {},
|
||||
prop = _.property('a');
|
||||
|
||||
strictEqual(prop(object), undefined);
|
||||
|
||||
prop = _.property('a[1].b.c');
|
||||
strictEqual(prop(object), undefined);
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
@@ -11810,6 +11820,14 @@
|
||||
|
||||
deepEqual(actual, expected);
|
||||
});
|
||||
|
||||
test('should return `undefined` if parts of `path` are missing', 2, function() {
|
||||
var object = {},
|
||||
propOf = _.propertyOf(object);
|
||||
|
||||
strictEqual(propOf('a'), undefined);
|
||||
strictEqual(propOf('a[1].b.c'), undefined);
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user