|
394 | 394 | var originalGetTimeFunc = Date.prototype.getTime; |
395 | 395 |
|
396 | 396 | throttledIncr(); |
397 | | - assert.strictEqual(counter, 1, '_.throttle: incr was called immediately'); |
| 397 | + assert.strictEqual(counter, 1, 'incr was called immediately'); |
398 | 398 |
|
399 | 399 | Date.prototype.getTime = function() { |
400 | 400 | return +(new Date(2013, 0, 1, 1, 1, 1)); |
|
405 | 405 |
|
406 | 406 | _.delay(function() { |
407 | 407 | 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'); |
409 | 409 | done(); |
410 | 410 | Date.now = originalNowFunc; |
411 | 411 | Date.prototype.getTime = originalGetTimeFunc; |
|
423 | 423 | var originalValueOfFunc = Date.prototype.valueOf; |
424 | 424 |
|
425 | 425 | throttledIncr(); |
426 | | - assert.strictEqual(counter, 1, '_.throttle: incr was called immediately'); |
| 426 | + assert.strictEqual(counter, 1, 'incr was called immediately'); |
427 | 427 |
|
428 | 428 | Date.prototype.valueOf = function() { |
429 | 429 | return null; |
|
437 | 437 |
|
438 | 438 | _.delay(function() { |
439 | 439 | 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'); |
441 | 441 | Date.now = originalNowFunc; |
442 | 442 | Date.prototype.getTime = originalGetTimeFunc; |
443 | 443 | Date.prototype.valueOf = originalValueOfFunc; |
444 | 444 | }, 200); |
445 | 445 |
|
446 | 446 | _.delay(function() { |
447 | 447 | 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'); |
449 | 449 | done(); |
450 | 450 | }, 400); |
451 | 451 | }); |
|
593 | 593 | var originalGetTimeFunc = Date.prototype.getTime; |
594 | 594 |
|
595 | 595 | debouncedIncr(); |
596 | | - assert.strictEqual(counter, 1, '_.debounce: incr was called immediately'); |
| 596 | + assert.strictEqual(counter, 1, 'incr was called immediately'); |
597 | 597 |
|
598 | 598 | Date.prototype.getTime = function() { |
599 | 599 | return +(new Date(2013, 0, 1, 1, 1, 1)); |
|
604 | 604 |
|
605 | 605 | _.delay(function() { |
606 | 606 | 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'); |
608 | 608 | done(); |
609 | 609 | Date.now = originalNowFunc; |
610 | 610 | Date.prototype.getTime = originalGetTimeFunc; |
|
623 | 623 | var originalValueOfFunc = Date.prototype.valueOf; |
624 | 624 |
|
625 | 625 | debouncedIncr(); |
626 | | - assert.strictEqual(counter, 1, '_.debounce: incr was called immediately'); |
| 626 | + assert.strictEqual(counter, 1, 'incr was called immediately'); |
627 | 627 |
|
628 | 628 | Date.prototype.valueOf = function() { |
629 | 629 | return null; |
|
637 | 637 |
|
638 | 638 | _.delay(function() { |
639 | 639 | 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'); |
641 | 641 | Date.now = originalNowFunc; |
642 | 642 | Date.prototype.getTime = originalGetTimeFunc; |
643 | 643 | Date.prototype.valueOf = originalValueOfFunc; |
644 | 644 | }, 200); |
645 | 645 |
|
646 | 646 | _.delay(function() { |
647 | 647 | 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'); |
649 | 649 | done(); |
650 | 650 | }, 400); |
651 | 651 | }); |
|
0 commit comments