Skip to content

Commit 3a5c878

Browse files
author
Ognjen Jevremovic
committedMar 8, 2021
test: Assertion comment updates; _.throttle and _.debounce.
Update the assertion comments in `_.throttle` and `_.debounce` unit tests, in order to prevent confusion and add more brevity to the test case messages.
1 parent 4d5d198 commit 3a5c878

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed
 

‎test/functions.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@
394394
var originalGetTimeFunc = Date.prototype.getTime;
395395

396396
throttledIncr();
397-
assert.strictEqual(counter, 1, '_.throttle: incr was called immediately');
397+
assert.strictEqual(counter, 1, 'incr was called immediately');
398398

399399
Date.prototype.getTime = function() {
400400
return +(new Date(2013, 0, 1, 1, 1, 1));
@@ -405,7 +405,7 @@
405405

406406
_.delay(function() {
407407
throttledIncr();
408-
assert.strictEqual(counter, 2, '_.throttle: incr was called successfully, with tampered system time');
408+
assert.strictEqual(counter, 2, 'incr was throttled successfully, with tampered system time');
409409
done();
410410
Date.now = originalNowFunc;
411411
Date.prototype.getTime = originalGetTimeFunc;
@@ -423,7 +423,7 @@
423423
var originalValueOfFunc = Date.prototype.valueOf;
424424

425425
throttledIncr();
426-
assert.strictEqual(counter, 1, '_.throttle: incr was called immediately');
426+
assert.strictEqual(counter, 1, 'incr was called immediately');
427427

428428
Date.prototype.valueOf = function() {
429429
return null;
@@ -437,15 +437,15 @@
437437

438438
_.delay(function() {
439439
throttledIncr();
440-
assert.strictEqual(counter, 2, '_.throttle: incr was debounced successfully, with tampered system time');
440+
assert.strictEqual(counter, 2, 'incr was throttled successfully, with tampered system time');
441441
Date.now = originalNowFunc;
442442
Date.prototype.getTime = originalGetTimeFunc;
443443
Date.prototype.valueOf = originalValueOfFunc;
444444
}, 200);
445445

446446
_.delay(function() {
447447
throttledIncr();
448-
assert.strictEqual(counter, 3, '_.throttle: incr was debounced successfully, after system time method restoration');
448+
assert.strictEqual(counter, 3, 'incr was throttled successfully, after system time method restoration');
449449
done();
450450
}, 400);
451451
});
@@ -593,7 +593,7 @@
593593
var originalGetTimeFunc = Date.prototype.getTime;
594594

595595
debouncedIncr();
596-
assert.strictEqual(counter, 1, '_.debounce: incr was called immediately');
596+
assert.strictEqual(counter, 1, 'incr was called immediately');
597597

598598
Date.prototype.getTime = function() {
599599
return +(new Date(2013, 0, 1, 1, 1, 1));
@@ -604,7 +604,7 @@
604604

605605
_.delay(function() {
606606
debouncedIncr();
607-
assert.strictEqual(counter, 2, '_.debounce: incr was debounced successfully, with tampered system time');
607+
assert.strictEqual(counter, 2, 'incr was debounced successfully, with tampered system time');
608608
done();
609609
Date.now = originalNowFunc;
610610
Date.prototype.getTime = originalGetTimeFunc;
@@ -623,7 +623,7 @@
623623
var originalValueOfFunc = Date.prototype.valueOf;
624624

625625
debouncedIncr();
626-
assert.strictEqual(counter, 1, '_.debounce: incr was called immediately');
626+
assert.strictEqual(counter, 1, 'incr was called immediately');
627627

628628
Date.prototype.valueOf = function() {
629629
return null;
@@ -637,15 +637,15 @@
637637

638638
_.delay(function() {
639639
debouncedIncr();
640-
assert.strictEqual(counter, 2, '_.debounce: incr was debounced successfully, with tampered system time');
640+
assert.strictEqual(counter, 2, 'incr was debounced successfully, with tampered system time');
641641
Date.now = originalNowFunc;
642642
Date.prototype.getTime = originalGetTimeFunc;
643643
Date.prototype.valueOf = originalValueOfFunc;
644644
}, 200);
645645

646646
_.delay(function() {
647647
debouncedIncr();
648-
assert.strictEqual(counter, 3, '_.debounce: incr was debounced successfully, after system time method restoration');
648+
assert.strictEqual(counter, 3, 'incr was debounced successfully, after system time method restoration');
649649
done();
650650
}, 400);
651651
});

0 commit comments

Comments
 (0)
Please sign in to comment.