mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Add _.invertBy tests.
This commit is contained in:
18
test/test.js
18
test/test.js
@@ -7674,11 +7674,25 @@
|
|||||||
QUnit.test('should only add multiple values to own, not inherited, properties', function(assert) {
|
QUnit.test('should only add multiple values to own, not inherited, properties', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
var expected = { 'hasOwnProperty': ['a'], 'constructor': ['b'] },
|
var object = { 'a': 'hasOwnProperty', 'b': 'constructor' },
|
||||||
object = { 'a': 'hasOwnProperty', 'b': 'constructor' };
|
expected = { 'hasOwnProperty': ['a'], 'constructor': ['b'] };
|
||||||
|
|
||||||
assert.ok(lodashStable.isEqual(_.invertBy(object), expected));
|
assert.ok(lodashStable.isEqual(_.invertBy(object), expected));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QUnit.test('should return a wrapped value when chaining', function(assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
|
||||||
|
if (!isNpm) {
|
||||||
|
var wrapped = _(object).invertBy();
|
||||||
|
|
||||||
|
assert.ok(wrapped instanceof _);
|
||||||
|
assert.deepEqual(wrapped.value(), { '1': ['a', 'c'], '2': ['b'] });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
skipAssert(assert, 2);
|
||||||
|
}
|
||||||
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|||||||
Reference in New Issue
Block a user