mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 18:37:50 +00:00
Add more tested strings to the case methods.
This commit is contained in:
14
test/test.js
14
test/test.js
@@ -1432,15 +1432,15 @@
|
|||||||
func = _[methodName];
|
func = _[methodName];
|
||||||
|
|
||||||
var strings = [
|
var strings = [
|
||||||
'hello world', 'Hello world', 'HELLO WORLD',
|
'foo bar', 'Foo bar', 'foo Bar', 'Foo Bar',
|
||||||
'helloWorld', '--hello-world', '__hello_world__'
|
'FOO BAR', 'fooBar', '--foo-bar', '__foo_bar__'
|
||||||
];
|
];
|
||||||
|
|
||||||
var expected = (function() {
|
var expected = (function() {
|
||||||
switch (caseName) {
|
switch (caseName) {
|
||||||
case 'camel': return 'helloWorld';
|
case 'camel': return 'fooBar';
|
||||||
case 'kebab': return 'hello-world';
|
case 'kebab': return 'foo-bar';
|
||||||
case 'snake': return 'hello_world';
|
case 'snake': return 'foo_bar';
|
||||||
}
|
}
|
||||||
}());
|
}());
|
||||||
|
|
||||||
@@ -1474,14 +1474,14 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('`_.' + methodName + '` should coerce `string` to a string', 2, function() {
|
test('`_.' + methodName + '` should coerce `string` to a string', 2, function() {
|
||||||
var string = 'Hello world';
|
var string = 'Foo Bar';
|
||||||
strictEqual(func(Object(string)), expected);
|
strictEqual(func(Object(string)), expected);
|
||||||
strictEqual(func({ 'toString': _.constant(string) }), expected);
|
strictEqual(func({ 'toString': _.constant(string) }), expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('`_.' + methodName + '` should return an unwrapped value when chaining', 1, function() {
|
test('`_.' + methodName + '` should return an unwrapped value when chaining', 1, function() {
|
||||||
if (!isNpm) {
|
if (!isNpm) {
|
||||||
strictEqual(_('hello world')[methodName](), expected);
|
strictEqual(_('foo bar')[methodName](), expected);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
skipTest();
|
skipTest();
|
||||||
|
|||||||
Reference in New Issue
Block a user