mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 10:07:48 +00:00
Consistent use of wrapped values in test titles.
This commit is contained in:
44
test/test.js
44
test/test.js
@@ -1286,11 +1286,11 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should return an existing wrapper', 2, function() {
|
test('should return existing wrapped values', 2, function() {
|
||||||
if (!isNpm) {
|
if (!isNpm) {
|
||||||
var wrapper = _({ 'a': 0 });
|
var wrapped = _({ 'a': 0 });
|
||||||
strictEqual(_.chain(wrapper), wrapper);
|
strictEqual(_.chain(wrapped), wrapped);
|
||||||
strictEqual(wrapper.chain(), wrapper);
|
strictEqual(wrapped.chain(), wrapped);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
skipTest(2);
|
skipTest(2);
|
||||||
@@ -1320,9 +1320,9 @@
|
|||||||
_.times(2, function(index) {
|
_.times(2, function(index) {
|
||||||
var array = ['one two three four', 'five six seven eight', 'nine ten eleven twelve'],
|
var array = ['one two three four', 'five six seven eight', 'nine ten eleven twelve'],
|
||||||
expected = { ' ': 9, 'e': 14, 'f': 2, 'g': 1, 'h': 2, 'i': 4, 'l': 2, 'n': 6, 'o': 3, 'r': 2, 's': 2, 't': 5, 'u': 1, 'v': 4, 'w': 2, 'x': 1 },
|
expected = { ' ': 9, 'e': 14, 'f': 2, 'g': 1, 'h': 2, 'i': 4, 'l': 2, 'n': 6, 'o': 3, 'r': 2, 's': 2, 't': 5, 'u': 1, 'v': 4, 'w': 2, 'x': 1 },
|
||||||
wrapper = index ? _(array).chain() : _.chain(array);
|
wrapped = index ? _(array).chain() : _.chain(array);
|
||||||
|
|
||||||
var actual = wrapper
|
var actual = wrapped
|
||||||
.chain()
|
.chain()
|
||||||
.map(function(value) { return value.split(''); })
|
.map(function(value) { return value.split(''); })
|
||||||
.flatten()
|
.flatten()
|
||||||
@@ -1336,8 +1336,8 @@
|
|||||||
deepEqual(actual, expected);
|
deepEqual(actual, expected);
|
||||||
|
|
||||||
array = [1, 2, 3, 4, 5, 6];
|
array = [1, 2, 3, 4, 5, 6];
|
||||||
wrapper = index ? _(array).chain() : _.chain(array);
|
wrapped = index ? _(array).chain() : _.chain(array);
|
||||||
actual = wrapper
|
actual = wrapped
|
||||||
.chain()
|
.chain()
|
||||||
.filter(function(n) { return n % 2; })
|
.filter(function(n) { return n % 2; })
|
||||||
.reject(function(n) { return n % 3 == 0; })
|
.reject(function(n) { return n % 3 == 0; })
|
||||||
@@ -1347,8 +1347,8 @@
|
|||||||
deepEqual(actual, [5, 1]);
|
deepEqual(actual, [5, 1]);
|
||||||
|
|
||||||
array = [3, 4];
|
array = [3, 4];
|
||||||
wrapper = index ? _(array).chain() : _.chain(array);
|
wrapped = index ? _(array).chain() : _.chain(array);
|
||||||
actual = wrapper
|
actual = wrapped
|
||||||
.reverse()
|
.reverse()
|
||||||
.concat([2, 1])
|
.concat([2, 1])
|
||||||
.unshift(5)
|
.unshift(5)
|
||||||
@@ -3961,10 +3961,10 @@
|
|||||||
strictEqual(func(array, Boolean), array);
|
strictEqual(func(array, Boolean), array);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('`_.' + methodName + '` should return the existing wrapper when chaining', 1, function() {
|
test('`_.' + methodName + '` should return the existing wrapped value when chaining', 1, function() {
|
||||||
if (!isNpm) {
|
if (!isNpm) {
|
||||||
var wrapper = _(array);
|
var wrapped = _(array);
|
||||||
strictEqual(wrapper[methodName](_.noop), wrapper);
|
strictEqual(wrapped[methodName](_.noop), wrapped);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
skipTest();
|
skipTest();
|
||||||
@@ -4127,10 +4127,10 @@
|
|||||||
deepEqual(actual, expected);
|
deepEqual(actual, expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('`_.' + methodName + '` should return the existing wrapper when chaining', 1, function() {
|
test('`_.' + methodName + '` should return the existing wrapped value when chaining', 1, function() {
|
||||||
if (!isNpm) {
|
if (!isNpm) {
|
||||||
var wrapper = _({ 'a': 1 });
|
var wrapped = _({ 'a': 1 });
|
||||||
strictEqual(wrapper[methodName]({ 'b': 2 }), wrapper);
|
strictEqual(wrapped[methodName]({ 'b': 2 }), wrapped);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
skipTest();
|
skipTest();
|
||||||
@@ -7428,19 +7428,19 @@
|
|||||||
ok(pass);
|
ok(pass);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should return the existing wrapper when chaining', 2, function() {
|
test('should return the existing wrapped value when chaining', 2, function() {
|
||||||
if (!isNpm) {
|
if (!isNpm) {
|
||||||
_.each([_, wrapper], function(func) {
|
_.each([_, wrapper], function(func) {
|
||||||
if (func === _) {
|
if (func === _) {
|
||||||
var wrapper = _(source),
|
var wrapped = _(source),
|
||||||
actual = wrapper.mixin();
|
actual = wrapped.mixin();
|
||||||
|
|
||||||
strictEqual(actual.value(), _);
|
strictEqual(actual.value(), _);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
wrapper = _(func);
|
wrapped = _(func);
|
||||||
actual = wrapper.mixin(source);
|
actual = wrapped.mixin(source);
|
||||||
strictEqual(actual, wrapper);
|
strictEqual(actual, wrapped);
|
||||||
}
|
}
|
||||||
delete func.a;
|
delete func.a;
|
||||||
delete func.prototype.a;
|
delete func.prototype.a;
|
||||||
|
|||||||
Reference in New Issue
Block a user