8000 Cleanup unit tests. · lodash/lodash@eb43786 · GitHub
[go: up one dir, main page]

Skip to content

Commit eb43786

Browse files
committed
Cleanup unit tests.
Former-commit-id: 460ffc3bd38c98dd86fc8c74d4720eed5d50433d
1 parent 0515db3 commit eb43786

File tree

2 files changed

+23
-26
lines changed

2 files changed

+23
-26
lines changed

test/test-ui.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
// assign `QUnit.config` properties
1616
QUnit.config.lodashFilename = (function() {
1717
switch (build) {
18+
case 'prod': return 'lodash.min';
1819
case 'custom': return 'lodash.custom.min';
1920
case 'custom-debug': return 'lodash.custom';
20-
case 'prod': return 'lodash.min';
2121
}
2222
return 'lodash';
2323
}());
@@ -52,13 +52,13 @@
5252

5353
dropdown.selectedIndex = (function() {
5454
switch (build) {
55-
case 'custom': return 3;
56-
case 'custom-debug': return 2;
5755
case 'prod': return 1;
56+
case 'custom': return 2;
57+
case 'custom-debug': return 3;
5858
}
5959
return 0;
6060
}());
61-
61+
6262
checkbox.checked = norequire;
6363
addEvent(checkbox, 'click', eventHandler);
6464
addEvent(dropdown, 'change', eventHandler);
@@ -77,8 +77,8 @@
7777
'<select name="build">' +
7878
'<option value="dev">developement</option>' +
7979
'<option value="prod">production</option>' +
80-
'<option value="custom-debug">custom (debug)</option>' +
8180
'<option value="custom">custom</option>' +
81+
'<option value="custom-debug">custom (debug)</option>' +
8282
'</select>build';
8383

8484
var checkbox = label1.firstChild,

test/test.js

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@
2424
/** Shortcut used to convert array-like objects to arrays */
2525
var slice = [].slice;
2626

27-
/** Used to resolve a value's internal [[Class]] */
28-
var toString = {}.toString;
29-
3027
/** Used to check problem JScript properties (a.k.a. the [[DontEnum]] bug) */
3128
var shadowed = {
3229
'constructor': 1,
@@ -638,9 +635,9 @@
638635
});
639636

640637
test('should allow a falsey `object` argument', function() {
641-
var fn = _.size;
638+
var func = _.size;
642639
try {
643-
var actual = [fn(), fn(undefined), fn(null), fn(false), fn(0)];
640+
var actual = [func(), func(undefined), func(null), func(false), func(0)];
644641
} catch(e) { }
645642

646643
deepEqual(actual, [0, 0, 0, 0, 0]);
@@ -907,15 +904,15 @@
907904
'zip',
908905
'zipObject'
909906
], function(methodName) {
910-
var fn = _[methodName],
907+
var func = _[methodName],
911908
pass = true;
912909

913910
try {
914-
fn();
915-
fn(undefined);
916-
fn(null);
917-
fn(false);
918-
fn(0);
911+
func();
912+
func(undefined);
913+
func(null);
914+
func(false);
915+
func(0);
919916
} catch(e) {
920917
pass = false;
921918
}
@@ -945,23 +942,23 @@
945942
'some',
946943
'toArray'
947944
], function(methodName) {
948-
var fn = _[methodName],
945+
var func = _[methodName],
949946
identity = _.identity,
950947
pass = true;
951948

952949
try {
953950
if (/^(?:contains|toArray)$/.test(methodName)) {
954-
fn();
955-
fn(undefined);
956-
fn(null);
957-
fn(false);
958-
fn(0);
951+
func();
952+
func(undefined);
953+
func(null);
954+
func(false);
955+
func(0);
959956
}
960957
else {
961-
fn(undefined, identity);
962-
fn(null, identity);
963-
fn(false, identity);
964-
fn(0, identity);
958+
func(undefined, identity);
959+
func(null, identity);
960+
func(false, identity);
961+
func(0, identity);
965962
}
966963
}< 1E0A /span> catch(e) {
967964
pass = false;

0 commit comments

Comments
 (0)
0