Cleanup fp test labels and args tests.

This commit is contained in:
John-David Dalton
2016-04-23 11:31:14 -07:00
parent fbc91cf7ae
commit 0125ff7303

View File

@@ -1022,7 +1022,7 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('fp.curry and fp.curryRight'); QUnit.module('curry methods');
_.each(['curry', 'curryRight'], function(methodName) { _.each(['curry', 'curryRight'], function(methodName) {
var func = fp[methodName]; var func = fp[methodName];
@@ -1036,7 +1036,7 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('fp.curryN and fp.curryRightN'); QUnit.module('curryN methods');
_.each(['curryN', 'curryRightN'], function(methodName) { _.each(['curryN', 'curryRightN'], function(methodName) {
var func = fp[methodName]; var func = fp[methodName];
@@ -1133,7 +1133,7 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('fp.flow and fp.flowRight'); QUnit.module('flow methods');
_.each(['flow', 'flowRight'], function(methodName) { _.each(['flow', 'flowRight'], function(methodName) {
var func = fp[methodName], var func = fp[methodName],
@@ -1343,12 +1343,11 @@
QUnit.test('should only provide `key` to `iteratee`', function(assert) { QUnit.test('should only provide `key` to `iteratee`', function(assert) {
assert.expect(1); assert.expect(1);
var args, var args;
object = { 'a': 1 };
fp.mapKeys(function() { fp.mapKeys(function() {
args || (args = slice.call(arguments)); args || (args = slice.call(arguments));
}, object); }, { 'a': 1 });
assert.deepEqual(args, ['a']); assert.deepEqual(args, ['a']);
}); });
@@ -1496,12 +1495,11 @@
QUnit.test('`fp.' + methodName + '` should provide `value` and `key` to `iteratee`', function(assert) { QUnit.test('`fp.' + methodName + '` should provide `value` and `key` to `iteratee`', function(assert) {
assert.expect(1); assert.expect(1);
var args, var args;
object = { 'a': 1 };
func(function() { func(function() {
args || (args = slice.call(arguments)); args || (args = slice.call(arguments));
})(object); })({ 'a': 1 });
assert.deepEqual(args, [1, 'a']); assert.deepEqual(args, [1, 'a']);
}); });
@@ -1542,7 +1540,7 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('fp.partial and fp.partialRight'); QUnit.module('partial methods');
_.each(['partial', 'partialRight'], function(methodName) { _.each(['partial', 'partialRight'], function(methodName) {
var func = fp[methodName], var func = fp[methodName],
@@ -1615,7 +1613,7 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('fp.reduce and fp.reduceRight'); QUnit.module('reduce methods');
_.each(['reduce', 'reduceRight'], function(methodName) { _.each(['reduce', 'reduceRight'], function(methodName) {
var func = fp[methodName], var func = fp[methodName],
@@ -1624,12 +1622,11 @@
QUnit.test('`_.' + methodName + '` should provide the correct `iteratee` arguments when iterating an array', function(assert) { QUnit.test('`_.' + methodName + '` should provide the correct `iteratee` arguments when iterating an array', function(assert) {
assert.expect(1); assert.expect(1);
var args, var args;
array = [1, 2, 3];
func(function() { func(function() {
args || (args = slice.call(arguments)); args || (args = slice.call(arguments));
})(0)(array); })(0)([1, 2, 3]);
assert.deepEqual(args, isReduce ? [0, 1] : [0, 3]); assert.deepEqual(args, isReduce ? [0, 1] : [0, 3]);
}); });