Add fp tests for placeholders.

This commit is contained in:
John-David Dalton
2016-02-02 22:26:03 -08:00
parent b0c2a8d5fd
commit 3a07b411fb

View File

@@ -510,6 +510,24 @@
QUnit.module('placeholder methods'); QUnit.module('placeholder methods');
(function() {
QUnit.test('should support placeholders', function(assert) {
assert.expect(6);
_.each([[], fp.__], function(ph) {
fp.placeholder = ph;
var actual = fp.add(ph, 'b')('a');
assert.strictEqual(actual, 'ab');
actual = fp.slice(ph, 2)(1)(['a', 'b', 'c']);
assert.deepEqual(actual, ['b']);
actual = fp.fill(ph, 2)(1, '*')([1, 2, 3]);
assert.deepEqual(actual, [1, '*', 3]);
});
});
_.forOwn(mapping.placeholder, function(truthy, methodName) { _.forOwn(mapping.placeholder, function(truthy, methodName) {
var func = fp[methodName]; var func = fp[methodName];
@@ -520,6 +538,7 @@
assert.strictEqual(func.placeholder, fp.__); assert.strictEqual(func.placeholder, fp.__);
}); });
}); });
}());
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/