Skip to content

Commit

Permalink
test: Assertion comment updates; _.throttle and _.debounce.
Browse files Browse the repository at this point in the history
Update the assertion comments in `_.throttle` and `_.debounce` unit tests,
in order to prevent confusion and add more brevity to the test case messages.
  • Loading branch information
Ognjen Jevremovic committed Mar 8, 2021
1 parent 4d5d198 commit 3a5c878
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/functions.js
Expand Up @@ -394,7 +394,7 @@
var originalGetTimeFunc = Date.prototype.getTime;

throttledIncr();
assert.strictEqual(counter, 1, '_.throttle: incr was called immediately');
assert.strictEqual(counter, 1, 'incr was called immediately');

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

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

throttledIncr();
assert.strictEqual(counter, 1, '_.throttle: incr was called immediately');
assert.strictEqual(counter, 1, 'incr was called immediately');

Date.prototype.valueOf = function() {
return null;
Expand All @@ -437,15 +437,15 @@

_.delay(function() {
throttledIncr();
assert.strictEqual(counter, 2, '_.throttle: incr was debounced successfully, with tampered system time');
assert.strictEqual(counter, 2, 'incr was throttled successfully, with tampered system time');
Date.now = originalNowFunc;
Date.prototype.getTime = originalGetTimeFunc;
Date.prototype.valueOf = originalValueOfFunc;
}, 200);

_.delay(function() {
throttledIncr();
assert.strictEqual(counter, 3, '_.throttle: incr was debounced successfully, after system time method restoration');
assert.strictEqual(counter, 3, 'incr was throttled successfully, after system time method restoration');
done();
}, 400);
});
Expand Down Expand Up @@ -593,7 +593,7 @@
var originalGetTimeFunc = Date.prototype.getTime;

debouncedIncr();
assert.strictEqual(counter, 1, '_.debounce: incr was called immediately');
assert.strictEqual(counter, 1, 'incr was called immediately');

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

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

debouncedIncr();
assert.strictEqual(counter, 1, '_.debounce: incr was called immediately');
assert.strictEqual(counter, 1, 'incr was called immediately');

Date.prototype.valueOf = function() {
return null;
Expand All @@ -637,15 +637,15 @@

_.delay(function() {
debouncedIncr();
assert.strictEqual(counter, 2, '_.debounce: incr was debounced successfully, with tampered system time');
assert.strictEqual(counter, 2, 'incr was debounced successfully, with tampered system time');
Date.now = originalNowFunc;
Date.prototype.getTime = originalGetTimeFunc;
Date.prototype.valueOf = originalValueOfFunc;
}, 200);

_.delay(function() {
debouncedIncr();
assert.strictEqual(counter, 3, '_.debounce: incr was debounced successfully, after system time method restoration');
assert.strictEqual(counter, 3, 'incr was debounced successfully, after system time method restoration');
done();
}, 400);
});
Expand Down

0 comments on commit 3a5c878

Please sign in to comment.