Add _.invertBy tests.

This commit is contained in:
John-David Dalton
2016-02-16 19:30:23 -08:00
parent 53168e4cfd
commit d9dc0e6fd1

View File

@@ -7674,11 +7674,25 @@
QUnit.test('should only add multiple values to own, not inherited, properties', function(assert) {
assert.expect(1);
var expected = { 'hasOwnProperty': ['a'], 'constructor': ['b'] },
object = { 'a': 'hasOwnProperty', 'b': 'constructor' };
var object = { 'a': 'hasOwnProperty', 'b': 'constructor' },
expected = { 'hasOwnProperty': ['a'], 'constructor': ['b'] };
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);
}
});
}());
/*--------------------------------------------------------------------------*/