|
15622 | 15622 | assert.deepEqual(over(5, 10), [10, 100]);
|
15623 | 15623 | });
|
15624 | 15624 |
|
| 15625 | + QUnit.test('should use `_.identity` when a predicate is nullish', function(assert) { |
| 15626 | + assert.expect(1); |
| 15627 | + |
| 15628 | + var over = _.overArgs(fn, undefined, null); |
| 15629 | + assert.deepEqual(over('a', 'b'), ['a', 'b']); |
| 15630 | + }); |
| 15631 | + |
| 15632 | + QUnit.test('should work with `_.property` shorthands', function(assert) { |
| 15633 | + assert.expect(1); |
| 15634 | + |
| 15635 | + var over = _.overArgs(fn, 'b', 'a'); |
| 15636 | + assert.deepEqual(over({ 'b': 2 }, { 'a': 1 }), [2, 1]); |
| 15637 | + }); |
| 15638 | + |
| 15639 | + QUnit.test('should work with `_.matches` shorthands', function(assert) { |
| 15640 | + assert.expect(1); |
| 15641 | + |
| 15642 | + var over = _.overArgs(fn, { 'b': 1 }, { 'a': 1 }); |
| 15643 | + assert.deepEqual(over({ 'b': 2 }, { 'a': 1 }), [false, true]); |
| 15644 | + }); |
| 15645 | + |
| 15646 | + QUnit.test('should work with `_.matchesProperty` shorthands', function(assert) { |
| 15647 | + assert.expect(1); |
| 15648 | + |
| 15649 | + var over = _.overArgs(fn, ['b', 1], [['a', 1]]); |
| 15650 | + assert.deepEqual(over({ 'b': 2 }, { 'a': 1 }), [false, true]); |
| 15651 | + }); |
| 15652 | + |
| 15653 | + QUnit.test('should differentiate between `_.property` and `_.matchesProperty` shorthands', function(assert) { |
| 15654 | + assert.expect(2); |
| 15655 | + |
| 15656 | + var over = _.overArgs(fn, ['a', 1]); |
| 15657 | + assert.deepEqual(over({ 'a': 1 }, { '1': 2 }), [1, 2]); |
| 15658 | + |
| 15659 | + over = _.overArgs(fn, [['a', 1]]); |
| 15660 | + assert.deepEqual(over({ 'a': 1 }), [true]); |
| 15661 | + }); |
| 15662 | + |
15625 | 15663 | QUnit.test('should flatten `transforms`', function(assert) {
|
15626 | 15664 | assert.expect(1);
|
15627 | 15665 |
|
@@ -16125,28 +16163,38 @@
|
16125 | 16163 | QUnit.test('should work with `_.property` shorthands', function(assert) {
|
16126 | 16164 | assert.expect(1);
|
16127 | 16165 |
|
16128 |
| - var object = { 'a': 1, 'b': 2 }, |
16129 |
| - over = _.over('b', 'a'); |
16130 |
| - |
16131 |
| - assert.deepEqual(over(object), [2, 1]); |
| 16166 | + var over = _.over('b', 'a'); |
| 16167 | + assert.deepEqual(over({ 'a': 1, 'b': 2 }), [2, 1]); |
16132 | 16168 | });
|
16133 | 16169 |
|
16134 | 16170 | QUnit.test('should work with `_.matches` shorthands', function(assert) {
|
16135 | 16171 | assert.expect(1);
|
16136 | 16172 |
|
16137 |
| - var object = { 'a': 1, 'b': 2 }, |
16138 |
| - over = _.over({ 'c': 3 }, { 'a': 1 }); |
16139 |
| - |
16140 |
| - assert.deepEqual(over(object), [false, true]); |
| 16173 | + var over = _.over({ 'b': 1 }, { 'a': 1 }); |
| 16174 | + assert.deepEqual(over({ 'a': 1, 'b': 2 }), [false, true]); |
16141 | 16175 | });
|
16142 | 16176 |
|
16143 | 16177 | QUnit.test('should work with `_.matchesProperty` shorthands', function(assert) {
|
16144 | 16178 | assert.expect(2);
|
16145 | 16179 |
|
16146 |
| - var over = _.over(['a', 2], [['b', 2]]); |
| 16180 | + var over = _.over(['b', 2], [['a', 2]]); |
16147 | 16181 |
|
16148 |
| - assert.deepEqual(over({ 'a': 1, 'b': 2 }), [false, true]); |
16149 |
| - assert.deepEqual(over({ 'a': 2, 'b': 1 }), [true, false]); |
| 16182 | + assert.deepEqual(over({ 'a': 1, 'b': 2 }), [true, false]); |
| 16183 | + assert.deepEqual(over({ 'a': 2, 'b': 1 }), [false, true]); |
| 16184 | + }); |
| 16185 | + |
| 16186 | + QUnit.test('should differentiate between `_.property` and `_.matchesProperty` shorthands', function(assert) { |
| 16187 | + assert.expect(4); |
| 16188 | + |
| 16189 | + var over = _.over(['a', 1]); |
| 16190 | + |
| 16191 | + assert.deepEqual(over({ 'a': 1, '1': 2 }), [1, 2]); |
| 16192 | + assert.deepEqual(over({ 'a': 2, '1': 1 }), [2, 1]); |
| 16193 | + |
| 16194 | + over = _.over([['a', 1]]); |
| 16195 | + |
| 16196 | + assert.deepEqual(over({ 'a': 1 }), [true]); |
| 16197 | + assert.deepEqual(over({ 'a': 2 }), [false]); |
16150 | 16198 | });
|
16151 | 16199 |
|
16152 | 16200 | QUnit.test('should provide arguments to predicates', function(assert) {
|
@@ -16205,34 +16253,43 @@
|
16205 | 16253 | QUnit.test('should work with `_.property` shorthands', function(assert) {
|
16206 | 16254 | assert.expect(2);
|
16207 | 16255 |
|
16208 |
| - var object = { 'a': 1, 'b': 2 }, |
16209 |
| - over = _.overEvery('a', 'c'); |
| 16256 | + var over = _.overEvery('b', 'a'); |
16210 | 16257 |
|
16211 |
| - assert.strictEqual(over(object), false); |
16212 |
| - |
16213 |
| - over = _.overEvery('b', 'a'); |
16214 |
| - assert.strictEqual(over(object), true); |
| 16258 | + assert.strictEqual(over({ 'a': 1, 'b': 1 }), true); |
| 16259 | + assert.strictEqual(over({ 'a': 0, 'b': 1 }), false); |
16215 | 16260 | });
|
16216 | 16261 |
|
16217 | 16262 | QUnit.test('should work with `_.matches` shorthands', function(assert) {
|
16218 | 16263 | assert.expect(2);
|
16219 | 16264 |
|
16220 |
| - var object = { 'a': 1, 'b': 2 }, |
16221 |
| - over = _.overEvery({ 'b': 2 }, { 'a': 1 }); |
16222 |
| - |
16223 |
| - assert.strictEqual(over(object), true); |
| 16265 | + var over = _.overEvery({ 'b': 2 }, { 'a': 1 }); |
16224 | 16266 |
|
16225 |
| - over = _.overEvery({ 'a': 1 }, { 'c': 3 }); |
16226 |
| - assert.strictEqual(over(object), false); |
| 16267 | + assert.strictEqual(over({ 'a': 1, 'b': 2 }), true); |
| 16268 | + assert.strictEqual(over({ 'a': 0, 'b': 2 }), false); |
16227 | 16269 | });
|
16228 | 16270 |
|
16229 | 16271 | QUnit.test('should work with `_.matchesProperty` shorthands', function(assert) {
|
16230 | 16272 | assert.expect(2);
|
16231 | 16273 |
|
16232 |
| - var over = _.overEvery(['a', 1], [['b', 2]]); |
| 16274 | + var over = _.overEvery(['b', 2], [['a', 1]]); |
16233 | 16275 |
|
16234 | 16276 | assert.strictEqual(over({ 'a': 1, 'b': 2 }), true);
|
16235 |
| - assert.strictEqual(over({ 'a': 1, 'b': -2 }), false); |
| 16277 | + assert.strictEqual(over({ 'a': 0, 'b': 2 }), false); |
| 16278 | + }); |
| 16279 | + |
| 16280 | + QUnit.test('should differentiate between `_.property` and `_.matchesProperty` shorthands', function(assert) { |
| 16281 | + assert.expect(5); |
| 16282 | + |
| 16283 | + var over = _.overEvery(['a', 1]); |
| 16284 | + |
| 16285 | + assert.strictEqual(over({ 'a': 1, '1': 1 }), true); |
| 16286 | + assert.strictEqual(over({ 'a': 1, '1': 0 }), false); |
| 16287 | + assert.strictEqual(over({ 'a': 0, '1': 1 }), false); |
| 16288 | + |
| 16289 | + over = _.overEvery([['a', 1]]); |
| 16290 | + |
| 16291 | + assert.strictEqual(over({ 'a': 1 }), true); |
| 16292 | + assert.strictEqual(over({ 'a': 2 }), false); |
16236 | 16293 | });
|
16237 | 16294 |
|
16238 | 16295 | QUnit.test('should flatten `predicates`', function(assert) {
|
@@ -16317,34 +16374,43 @@
|
16317 | 16374 | QUnit.test('should work with `_.property` shorthands', function(assert) {
|
16318 | 16375 | assert.expect(2);
|
16319 | 16376 |
|
16320 |
| - var object = { 'a': 1, 'b': 2 }, |
16321 |
| - over = _.overSome('c', 'a'); |
16322 |
| - |
16323 |
| - assert.strictEqual(over(object), true); |
| 16377 | + var over = _.overSome('b', 'a'); |
16324 | 16378 |
|
16325 |
| - over = _.overSome('d', 'c'); |
16326 |
| - assert.strictEqual(over(object), false); |
| 16379 | + assert.strictEqual(over({ 'a': 1, 'b': 0 }), true); |
| 16380 | + assert.strictEqual(over({ 'a': 0, 'b': 0 }), false); |
16327 | 16381 | });
|
16328 | 16382 |
|
16329 | 16383 | QUnit.test('should work with `_.matches` shorthands', function(assert) {
|
16330 | 16384 | assert.expect(2);
|
16331 | 16385 |
|
16332 |
| - var object = { 'a': 1, 'b': 2 }, |
16333 |
| - over = _.overSome({ 'c': 3 }, { 'a': 1 }); |
16334 |
| - |
16335 |
| - assert.strictEqual(over(object), true); |
| 16386 | + var over = _.overSome({ 'b': 2 }, { 'a': 1 }); |
16336 | 16387 |
|
16337 |
| - over = _.overSome({ 'b': 1 }, { 'a': 2 }); |
16338 |
| - assert.strictEqual(over(object), false); |
| 16388 | + assert.strictEqual(over({ 'a': 0, 'b': 2 }), true); |
| 16389 | + assert.strictEqual(over({ 'a': 0, 'b': 0 }), false); |
16339 | 16390 | });
|
16340 | 16391 |
|
16341 | 16392 | QUnit.test('should work with `_.matchesProperty` shorthands', function(assert) {
|
16342 | 16393 | assert.expect(2);
|
16343 | 16394 |
|
16344 | 16395 | var over = _.overSome(['a', 1], [['b', 2]]);
|
16345 | 16396 |
|
16346 |
| - assert.strictEqual(over({ 'a': 3, 'b': 2 }), true); |
16347 |
| - assert.strictEqual(over({ 'a': 2, 'b': 3 }), false); |
| 16397 | + assert.strictEqual(over({ 'a': 0, 'b': 2 }), true); |
| 16398 | + assert.strictEqual(over({ 'a': 0, 'b': 0 }), false); |
| 16399 | + }); |
| 16400 | + |
| 16401 | + QUnit.test('should differentiate between `_.property` and `_.matchesProperty` shorthands', function(assert) { |
| 16402 | + assert.expect(5); |
| 16403 | + |
| 16404 | + var over = _.overSome(['a', 1]); |
| 16405 | + |
| 16406 | + assert.strictEqual(over({ 'a': 0, '1': 0 }), false); |
| 16407 | + assert.strictEqual(over({ 'a': 1, '1': 0 }), true); |
| 16408 | + assert.strictEqual(over({ 'a': 0, '1': 1 }), true); |
| 16409 | + |
| 16410 | + over = _.overSome([['a', 1]]); |
| 16411 | + |
| 16412 | + assert.strictEqual(over({ 'a': 1 }), true); |
| 16413 | + assert.strictEqual(over({ 'a': 2 }), false); |
16348 | 16414 | });
|
16349 | 16415 |
|
16350 | 16416 | QUnit.test('should flatten `predicates`', function(assert) {
|
|
0 commit comments